Created
May 18, 2018 18:26
-
-
Save discarn8/de2c4db18be38844fa29f3e4912e8c6f to your computer and use it in GitHub Desktop.
EXCEL - Clear_sheets.vba
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Option Explicit | |
| Sub CLEARDATA() | |
| On Error GoTo ErrHandler | |
| Dim arrSHEETS As Variant | |
| Dim wsheets As Variant | |
| arrSHEETS = Split("Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,Golf,Hotel", ",") | |
| Sheets("Errors").Range("A1:BBB20000").ClearFormats | |
| Sheets("Errors").Tab.ColorIndex = xlColorIndexNone | |
| Sheets("CSV").Tab.ColorIndex = xlColorIndexNone | |
| For Each wsheets In arrSHEETS | |
| Worksheets(wsheets).Range("A1:BBB20000").ClearContents | |
| Worksheets(wsheets).Cells.ClearComments | |
| Sheets(wsheets).Select | |
| Cells(1, 1).Activate | |
| Next wsheets | |
| Sheets("CSV").Select | |
| Cells(2, 1).Activate | |
| Exit Sub | |
| ErrHandler: | |
| MsgBox "I'm sorry - there was an error performing this task." | |
| Resume Next | |
| End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment