Greetings All, Very beginner here. Thanks in advance for any help anyone can give me. I’ve searched through this forum and haven’t come up with a solution to my issue.
I'm trying to search all worksheets, with the exception of three ("MASTER", "CUSTOMER" and "AVAILABLE"), clear specific cells in the remaining sheets if they meet a specific test. The cells I want to search are in each worksheet in cells "D7:D9". If they are equal to or less than today’s date, I what to clear the cell. I get an error code "Invalid Next Control” on the NEXT I statement. Any thoughts on what I'm missing? Sorry but I’m not 100% sure on how to upload code to a post.
I'm trying to search all worksheets, with the exception of three ("MASTER", "CUSTOMER" and "AVAILABLE"), clear specific cells in the remaining sheets if they meet a specific test. The cells I want to search are in each worksheet in cells "D7:D9". If they are equal to or less than today’s date, I what to clear the cell. I get an error code "Invalid Next Control” on the NEXT I statement. Any thoughts on what I'm missing? Sorry but I’m not 100% sure on how to upload code to a post.
VBA Code:
Sub DeleteDatesAA()
Dim WS_Count As Integer
Dim I As Integer
' Set WS_Count equal to the number of worksheets in the active workbook.
WS_Count = ActiveWorkbook.Worksheets.Count
' Begin the loop.
For I = 1 To WS_Count
If ws.Name <> "MASTER" Or ws.Name <> "CUSTOMER" Or ws.Name <> "AVAILABLE" Then
Else
For Each cell In ws.Range("D7:D9")
' If the cell date is TODAY or after TODAY for the Return date
If Sheet.Cells(9, 4).Value < (Date + 1) Then
' Clear the contents of Return date
cell.ClearContents
End If
Next I
End Sub