I'm trying to clear the contents on multiple worksheets, from row 2 through the last row. I'm running into an issue where I'm trying to skip the worksheet if row 2 is already empty. Here's my code. I'm getting a Next Without For error message.
Code:
Sub ClearData()
Application.ScreenUpdating = False
Dim ws As Worksheet
For Each ws In Worksheets
If Not ws.Name = "Summaries" And Not ws.Name = "Consolidated" And Not ws.Name = "Variables" Then
If ws.FilterMode = True Then
ws.ShowAllData
Else
End If
If ws.Range("A2").Value <> "" Then
With ws.Range("A2:P" & ws.Range("A2" & Rows.Count).End(xlUp).Row)
.ClearContents
End With
Else
End If
Next ws
Application.ScreenUpdating = True
End Sub