View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Haraldo Haraldo is offline
external usenet poster
 
Posts: 1
Default Deleting a sheet via code

Try this version:

Sub ABB()
Dim sh As Worksheet
Dim cnt As Long
Dim ans As Long
For Each sh In ActiveWorkbook.Worksheets
If InStr(1, sh.Name, "AC Details", vbTextCompare) 0 Then
cnt = Application.CountA(sh.Range("F9:B*H1000"))
If cnt = 0 Then
ans = MsgBox("Delete Sheet Name " & sh.Name, vbYesNo)
If ans = vbYes Then
Application.DisplayAlerts = False
sh.Delete
Application.DisplayAlerts = True
End If
End If
End If
Next


End Sub