selecting sheets in vb
PeterG,
Here's one way:
Sub testit()
Dim wks As Worksheet, arr() As Worksheet, i As Long, blnTemp As Boolean
ReDim arr(0)
For Each wks In Worksheets
Select Case wks.Name
Case "Sheet2"
Case Else
i = UBound(arr) + 1
ReDim Preserve arr(i)
Set arr(i) = wks
End Select
Next
blnTemp = Application.DisplayAlerts
Application.DisplayAlerts = False
For i = 1 To UBound(arr)
arr(i).Delete
Next
Application.DisplayAlerts = blnTemp
End Sub
Rob
"peterG" wrote in message
...
I want to be able to delete all sheets from a workbook
except a few specific ones.
Is there any way to get a list of current sheets in a
form where I can delete the names I want to keep and
select the rest?
TIA
peterG
|