Excel VBA Macro - Copy and insert copied cells

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

Answers


Untested.

Is this what you are trying?

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

Need Your Help

Filter sequences

python biopython

I have a bit of a fight with biopython, I am trying to filter a set of protein sequences based on 3 criterias:

SUMO: pass only TLS phases

ssl simulator duration traffic phase

I am using SUMO and for testing purposes I want to pass TLS phases. When declaring my TLS in an additional file, I am required to also pass the duration of the phase, but I want SUMO to fill that i...