willow1985
Well-known Member
- Joined
- Jul 24, 2019
- Messages
- 929
- Office Version
- 365
- Platform
- Windows
I have a report that fills in data from B10 to N10 and down. the amount of rows that get filled can vary and sometimes it is only 1 row of data B10:N10.
I like to Number these rows in column A starting with A10 as "1".
I want to modify my VBA code to number the rows if there is more than 1 row of data (basically if there is data in B11).
How would I modify this code?
If there is data in B11 fill series to end, if not proceed to the next part of the code.
Thank you to anyone who can help!
I like to Number these rows in column A starting with A10 as "1".
I want to modify my VBA code to number the rows if there is more than 1 row of data (basically if there is data in B11).
How would I modify this code?
If there is data in B11 fill series to end, if not proceed to the next part of the code.
Thank you to anyone who can help!
VBA Code:
Range("A10").Select
ActiveCell.FormulaR1C1 = "1"
'Here is the part I need modified:
Range("A10").AutoFill Destination:=Range("A10:A" & Cells(Rows.Count, "B").End(xlUp).Row), Type:=xlFillSeries
Calculate
Range("A1").Select
Sheets("DATA").Select
If (ActiveSheet.AutoFilterMode And ActiveSheet.FilterMode) Or ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
Sheets("Weekly").Select
Application.ScreenUpdating = True
MsgBox "Weekly Report Complete"
End Sub