lior03
06-14-2006, 04:05 AM
hello
i am trying to delete all sheets in a workbook,except the active sheet.
whats wrong with this code
On Error Resume Next
Dim wkSt As String
Dim wkBk As Worksheet
wkSt = ActiveSheet.Name
For Each wkBk In ActiveWorkbook.Worksheets
wkBk.Activate
If wkBk.Name <> wkSt Then
wkBk.Delete
End If
Next
thanks
i am trying to delete all sheets in a workbook,except the active sheet.
whats wrong with this code
On Error Resume Next
Dim wkSt As String
Dim wkBk As Worksheet
wkSt = ActiveSheet.Name
For Each wkBk In ActiveWorkbook.Worksheets
wkBk.Activate
If wkBk.Name <> wkSt Then
wkBk.Delete
End If
Next
thanks