Question : Combining VBA Statement

Is there a way to combine line 2 and 3?  For some reason it is not selecting the MFL sheet and Deleting the wrong one.  Also is there a way to delete it whether it is a hidden sheet or not?

Please advise and thanks. -R-
1:
2:
3:
4:
Application.DisplayAlerts = False
Sheets("MFL").Select
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True

Answer : Combining VBA Statement

for hidden sheet, you can check if hidden sheet, then make it visible before you delete.

if  Sheets("MFL").Visible = false then
   Sheets("MFL").Visible = true
    Sheets("MFL").Select
    ActiveWindow.SelectedSheets.Delete
else
 Sheets("MFL").Select
    ActiveWindow.SelectedSheets.Delete
end if
Random Solutions  
 
programming4us programming4us