MorningReport.xls
Hello guys,
I have this macro, which I need to run in through all sheets but I haven't find the way. Could you help me? thanks!!
Sub DeleteSheets()
'Deletes the sheets when it doesnt find the dims.
Dim CP(3), found_col, found_cl, count
CP(0) = "WSD"
CP(1) = "AFM"
CP(2) = "DKD"
CP(3) = "SDF"
count = 0
search_routine:
On Error GoTo not_found
Set found_col = Workbooks("MorningReport.xls").ActiveSheet.Cells.Find( _
What:="Resp. Co", After:=Workbooks("MorningReport.xls").ActiveSheet.Range("A1"), _
LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).EntireColumn
Set found_cl = found_col.Find(CP(count))
If found_cl Is Nothing Then GoTo not_found
Exit Sub
not_found:
If count = 3 Then
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
Else
count = count + 1
GoTo search_routine
End If
End Sub
Bookmarks