auto.pilot
Well-known Member
- Joined
- Sep 27, 2007
- Messages
- 734
- Office Version
- 365
- Platform
- Windows
I have the following code which simply fills the range starting in cell A5 (down) to the end of the populated cells in column B. It works, but I'd like to instead fill only the visible cells. For example, if rows 10 & 11 are hidden or filtered, I'd like to return nothing. Then, I need to continue the sequential numbers in row 12.
How can I do this?
How can I do this?
Code:
Sub Sequential()
Dim Lst As Long
Lst = Range("B" & Rows.Count).End(xlUp).Row - 4
With Range("A5")
.Value = "1"
.AutoFill Destination:=Range("A5").Resize(Lst), Type:=xlFillSeries
End With
End Sub