6

I can't seem to make to this work. I keep getting stuck on

    Rows(rng 5).Select

What I am trying to do is copy the row of the active cell and inserting the copied cell in a row that is 5 rows below the active cell.

Sub CopyConcatenate()


    Dim ws As Worksheet
    Dim rng As Range

    Set rng = ActiveCell.Rows

    rng.Select
    Selection.Copy
    Rows(rng 5).Select
    Selection.Insert Shift:=xlDown

End Sub
3
  • What are you trying to do in Rows(rng 5).Select ? This should through an error cause the syntax is incorrect. Commented Jan 30, 2014 at 11:52
  • I'm trying to select the row that is 5 rows below the one with the active cell. Commented Jan 30, 2014 at 11:55
  • 1
    Did you see the answer below? Commented Jan 30, 2014 at 11:57

1 Answer 1

20

Try this

Sub CopyConcatenate()
    Dim ws As Worksheet
    Dim rng As Range
    
    '~~> Set this to the relevant worksheet
    Set ws = ThisWorkbook.Sheets("Sheet1")
    
    With ws
        '~~> Set your range
        Set rng = .Rows(ActiveCell.Row)
        
        '~~> Copy the range
        rng.Copy
        
        '~~> Insert the range
        rng.Offset(5).Insert Shift:=xlDown
        
        '~~> Clear the clipboard. More importantly remove the
        '~~> ant like borders
        Application.CutCopyMode = False
    End With
End Sub
Sign up to request clarification or add additional context in comments.

1 Comment

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.