Hi, I am trying to get the code below to loop down X number of times. With maxi being a dynamic range name. It copies down cell A2 and adds 1 each time. But to the length maxi declares. If i use a number it works but not if I declare it.
Can someone tell me what I'm doing wrong please.
Sub for_demo()
Dim Add1 As Integer
Dim maxi As Variant
For Add1 = 1 To maxi Step 1
ActiveCell.Value = Range("A2").Value + 1
ActiveCell.Offset(1, 0).Select
Next
End Sub
Can someone tell me what I'm doing wrong please.
Sub for_demo()
Dim Add1 As Integer
Dim maxi As Variant
For Add1 = 1 To maxi Step 1
ActiveCell.Value = Range("A2").Value + 1
ActiveCell.Offset(1, 0).Select
Next
End Sub