Hello All:
I have a list of sheets that I would like to delete from a current workbook. The list is in a sheet named "Funds" in the column A. I would like to write VBA code to delete sheets based on whether or not the names are on this sheet "Funds".
Thank you all for you help in advance. The code which I`m using is below however it does not do anything, have no idea why.
Sub DeleteSheets()
Dim wks As Worksheet
Dim MyRange As Range
Dim Cell As Range
Set wks = Worksheets("Funds")
With wks
Set MyRange = Range("A1", .Cells(.Rows.Count, "A").End(xlUp))
End With
On Error Resume Next
Application.DisplayAlerts = False
For Each Cell In MyRange
Sheets(Cell.Value).Delete
Next Cell
Application.DisplayAlerts = True
On Error GoTo 0
End Sub
Bookmarks