larinda4
Board Regular
- Joined
- Nov 15, 2021
- Messages
- 74
- Office Version
- 365
- Platform
- Windows
Hi guys,
I have my code below. I need to "auto fill" my formulas in cells H2:P2 down until it hits the first blank row. Unfortunately, the code I'm using will auto fill until the last row used in the sheet. I have inserted a blank row between data where I would need the code to stop. I have it referencing column G currently.
Any tips?
Here is my code. I have 2 that I've been playing around with:
Dim lastrow As Long
lastrow = Range("G" & rows.Count).End(xlUp).Row
Range("H2:P2").AutoFill Destination:=Range("H2:P" & lastrow), Type:=xlFillDefault
and the other one:
With Sheets("Code")
.Range("H2:P2").AutoFill .Range("H2:P" & .Cells(.rows.Count, "G").End(xlUp).Row)
End With
I have my code below. I need to "auto fill" my formulas in cells H2:P2 down until it hits the first blank row. Unfortunately, the code I'm using will auto fill until the last row used in the sheet. I have inserted a blank row between data where I would need the code to stop. I have it referencing column G currently.
Any tips?
Here is my code. I have 2 that I've been playing around with:
Dim lastrow As Long
lastrow = Range("G" & rows.Count).End(xlUp).Row
Range("H2:P2").AutoFill Destination:=Range("H2:P" & lastrow), Type:=xlFillDefault
and the other one:
With Sheets("Code")
.Range("H2:P2").AutoFill .Range("H2:P" & .Cells(.rows.Count, "G").End(xlUp).Row)
End With