Hi, i'm trying to get the section of code [For i = 1 to N] through [Next i] to loop within the larger loop. Does anyone know how to do this?
![]()
Sub Test1() Dim x As Integer ' Set numrows = number of rows of data. NumRows = Range("K1", Range("K1").End(xlDown)).Rows.Count 'MsgBox NumRows ' Select cell K1. Range("K1").Select N = 21 ' Establish "For" loop to loop "numrows" number of times. For x = 1 To NumRows ' Insert your code here. ' Selects cell down 1 row from active cell. Selection.Copy Range("A65536").End(xlUp).Offset(0, 0).Select For i = 1 To N Selection.Offset(Selection.Rows.Count, 0).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Next i Rows(1).Delete 'end your code here. Next End Sub











LinkBack URL
About LinkBacks
Register To Reply

Bookmarks