Hi Anush,
your code did not actually delete sheets but deleted entries from your funds table. The following code should work:
Let me know if this works for you.![]()
Option Explicit Sub DeleteSheets() Dim wks As Worksheet Dim wkf As Worksheet Dim SheetName As String Dim check As Boolean Dim Rng As Range Set wkf = Worksheets("Funds") 'loop through all worksheets For Each wks In ActiveWorkbook.Worksheets() Set Rng = Nothing SheetName = wks.Name On Error Resume Next 'check if the name of the sheet is included in the funds list Set Rng = wkf.Range("a:a").Find(SheetName, LookAt:=xlWhole) On Error GoTo 0 If Not Rng Is Nothing Then 'included in list Application.DisplayAlerts = False 'Surpress warning message wks.Delete 'delete worksheet Application.DisplayAlerts = True End If Next wks Set wkf = Nothing Set Rng = Nothing End Sub
Theo
Bookmarks