I have the following loop code that I need to run upon close of the workbook. However, it only runs on the active worksheet. I need to delete the data in rows 3-1,000 of each worksheet. There are three worksheets (listed in code) that I do not need cleared upon closing. Please help me see what I am missing. I have tried a few varieties of this same code, however I have not had a successful run. Thank you in advance.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
For Each ws In Worksheets
If ws.Name <> "NAV DATA" And ws.Name <> "CAL DATA" And ws.Name <> "RESULTS" Then
Rows("3:1000").Select
Selection.ClearContents
Range("A2").Select
End If
Next ws
End Sub
Bookmarks