• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Not able to copy rows via VB

kamal bhatt

New Member
Hello,

I am trying to use VB for repeating 3 itenaries in a table, 31 times each. Not able to do so. using the below mentioned script. Can anyone help?

Code:
Sub Do_It()
    Application.ScreenUpdating = False
    With ActiveSheet
        .Range("A2:L2").Copy Destination:=.Range("N2")
        N = 3
        a = 3
        Do
            .Range("A" & a & ":L" & a).Copy
            .Range(.Cells(N, "N"), .Cells(N + 30, "N")).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
            a = a + 5
            l = N + 5
        Loop Until .Cells(a, "A") = Empty
    End With
    With Application
        .CutCopyMode = False
        .ScreenUpdating = True
    End With
   
End Sub
 

Attachments

  • Insert Rows and repeat data.xlsb
    18 KB · Views: 2
Last edited by a moderator:
it is done now.. Thanks.. used

Code:
Sub Do_It()
    Application.ScreenUpdating = False
    With ActiveSheet
        .Range("A2:L2").Copy Destination:=.Range("N2")
        f = 3
        a = 3
        Do
            .Range("A" & a & ":L" & a).Copy
            .Range(.Cells(f, "N"), .Cells(f + 30, "N")).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
            a = a + 1
            f = f + 31
        Loop Until .Cells(a, "A") = Empty
    End With
    With Application
        .CutCopyMode = False
        .ScreenUpdating = True
    End With
End Sub
 
Last edited by a moderator:
Back
Top