Hi there,
Need your help again, I have the below that works as long as my lastRow count is greater than 2.
So I wanted to add the condition in red. " If lastRow > 2 Then".
But now I have an error "Compile error: Next without for" . Why that ? I have a For. Thanks
Need your help again, I have the below that works as long as my lastRow count is greater than 2.
So I wanted to add the condition in red. " If lastRow > 2 Then".
But now I have an error "Compile error: Next without for" . Why that ? I have a For. Thanks
Rich (BB code):
Sub Sheet_Date2()
'take3'
Dim lstRow As Long
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Master" And ws.Name <> "Summary" And ws.Name <> "Shaping" Then
lastRow = ws.Range("AR" & Rows.Count).End(xlUp).Row
If lastRow > 2 Then
ws.Range("AT2").AutoFill Destination:=ws.Range("AT2:AT" & lastRow)
End If
Next ws
End Sub
Last edited by a moderator: