PDA

View Full Version : What's wrong with this code?



YYF330
06-29-2021, 11:40 AM
I'm using Macro recorder but want to not fix the selected range. But the code can't go through. What's wrong with the following code? and how to debug?:crying:


Selection.AutoFill Destination:=Range("I2", "I" & Cells(Rows.Count, 9).End(xlUp).Row)

Bob Phillips
06-29-2021, 11:45 AM
Maybe


lastrow = Cells(Rows.Count,"I").End(xlUp).Row
Selection.AutoFill Destination:=Range("I2").Resize(lastrow-1)

SamT
06-29-2021, 12:05 PM
Selection.AutoFill Destination:=Range(Range("I2"), Cells(Rows.Count, "I").End(xlUp))