Hi Experts - Good day! I have below code which is always the beginning of my process. I wan't to clear the table of any data for sheets Check and SRPT. The code is working as expected everytime there's data under the columns i'm trying to delete. However, if there's no data under the headers, the code below is deleting even the headers (which i don't want to happen..) Can you please help on this? For the formula on columns ZZ3:AAH - i wanted the code to start deleting on row 3 and not delete 1st and second rows. For the range A2:H, i want the code to start deleting from row 2 until the last row with data.. Hope someone can help. Thank you!
Code:
Sub Clear()
Application.ScreenUpdating = False
Dim Ws As Worksheet
Dim Last_Row As Long
Dim Formula_Row As Long
Sheets("Check").Select
ActiveSheet.AutoFilterMode = False
''This is solid for Advanced Filter:
On Error Resume Next
ActiveSheet.ShowAllData
Err.Clear
Last_Row = Range("A" & Rows.Count).End(xlUp).Row
Range("A2:H" & Last_Row).Clear
Formula_Row = Range("AAE" & Rows.Count).End(xlUp).Row
Range("ZZ3:AAH" & Last_Row).Clear
ActiveSheet.[A1].Select
Sheets("SRPT").Select
ActiveSheet.AutoFilterMode = False
''This is solid for Advanced Filter:
On Error Resume Next
ActiveSheet.ShowAllData
Err.Clear
Last_Row = Range("A" & Rows.Count).End(xlUp).Row
Range("A2:K" & Last_Row).Clear
Range("M2:S" & Last_Row).Clear
ActiveSheet.[A1].Select
Sheets("MENU").Select
MsgBox "All sheets are cleared, you may now proceed with checks"
Application.ScreenUpdating = True
End Sub