Hi all,
I am experiencing the below issue with my VBA drag-down code across many sheets. It works for the first sheet then gets stuck - and help as to why would be appreciated. Here is the error message: https://ibb.co/j4rB86H
Here is the code:
Note: Sheets("UPDATE").Select j = Cells(2, "H").Value is the number of cells to drag down, generally 1.
It should cycle through all the sheets listed under the array.
Can anyone see what I have got wrong?
I am experiencing the below issue with my VBA drag-down code across many sheets. It works for the first sheet then gets stuck - and help as to why would be appreciated. Here is the error message: https://ibb.co/j4rB86H
Here is the code:
Code:
Sub DragDown()
Dim LR As Integer
Dim LR1 As Integer
Dim i As Integer
Dim dragSheets As Variant
Application.ScreenUpdating = False
Sheets("UPDATE").Select
j = Cells(2, "H").Value
dragSheets = Array("NAMTB", "GC21", "GC22", "GC23", "GC24", "GC25", "GC27", "GC30", "GC32", "GC35", "GC37", "GC40", "GC43", "GC45", "GC50", "GI22", "GI25", "GI29", "GI33", "GI36", "Relatives", "TB Relatives", "Average Spreads", "Generic", "Slope", "USDZAR", "MD")
For i = 0 To UBound(dragSheets)
Sheets(dragSheets(i)).Select
LR = Sheets(dragSheets(i)).Cells(Rows.Count, 1).End(xlUp).Row
LRP = LR + j
Range("A" & LR & ":ZZ" & LR).Select
Selection.AutoFill Destination:=Range("A" & LR & ":ZZ" & LRP), Type:=xlFillDefault
Next i
Sheets("UPDATE").Select
MsgBox ("Drag Down Complete")
Application.ScreenUpdating = True
End Sub
Note: Sheets("UPDATE").Select j = Cells(2, "H").Value is the number of cells to drag down, generally 1.
It should cycle through all the sheets listed under the array.
Can anyone see what I have got wrong?