I have to do some data cleaning of different files where every sheet has its unique name.
The sheet with the macrobutton should be saved, the rest of the sheets deleted. Why doesn't the following work:
<code>
Dim ws As Worksheet
dim MADDATA as Worksheet
Set MADDATA = ActiveSheet
Application.DisplayAlerts = False
For Each ws In Worksheets
If ws <> MADDATA Then
ws.Delete
End If
Next
Application.DisplayAlerts = True
</code>
Help would be much appreciated!
The sheet with the macrobutton should be saved, the rest of the sheets deleted. Why doesn't the following work:
<code>
Dim ws As Worksheet
dim MADDATA as Worksheet
Set MADDATA = ActiveSheet
Application.DisplayAlerts = False
For Each ws In Worksheets
If ws <> MADDATA Then
ws.Delete
End If
Next
Application.DisplayAlerts = True
</code>
Help would be much appreciated!