I'm trying to execute a macro several times. I want to execute it based on the number of cells containing a number within a specific column on a specific sheet.
I tried to write a do until loop, but I get a syntax error for the "do until i =" line.
Sub copy_paste_to_first_blank_row()
Dim i As Integer
i = 1
Do Until i = COUNT(input!E:E)
Range("A1:D76").Select
Selection.Copy
Cells(Range("A1000000").End(xlUp).Row + 1, 1).Select
ActiveSheet.Paste
i = i + 1
Loop
End Sub
Since in my given situation count(input!E:E) = 93, I would expect the loop to be run 92 times and then stop. I get the error message "compile error: syntax error" when I try to run it; it highlights the "do until" line.
...
Now I've tried
Dim i As Integer, x As Integer
Worksheets("input").Activate
x = Range("E:E").Count
i = 1
Do Until i = x
Range("A1:D76").Select
Selection.Copy
Cells(Range("A1000000").End(xlUp).Row + 1, 1).Select
ActiveSheet.Paste
i = i + 1
Loop
I get the error "Run-time error '6': Overflow".