Delete Selected Worksheets Macro
I have a workbook with 500 tabs. 200 of the tabs are named: FI (1), FI (2),
FI (3), etc. I want to delete all tabs that start with FI. I've tried the below without success - any suggestions? Here's what I have: Dim ws As Worksheet Application.DisplayAlerts = False For Each ws In Worksheets If ws.Name = "FI (*)" Then ws.Delete Next Application.DisplayAlerts = True |
Delete Selected Worksheets Macro
Sub FI_killer()
Application.DisplayAlerts = False For Each w In Worksheets If Left(w.Name, 2) = "FI" Then w.Delete End If Next Application.DisplayAlerts = True End Sub -- Gary''s Student - gsnu200822 "Indianagreg" wrote: I have a workbook with 500 tabs. 200 of the tabs are named: FI (1), FI (2), FI (3), etc. I want to delete all tabs that start with FI. I've tried the below without success - any suggestions? Here's what I have: Dim ws As Worksheet Application.DisplayAlerts = False For Each ws In Worksheets If ws.Name = "FI (*)" Then ws.Delete Next Application.DisplayAlerts = True |
Delete Selected Worksheets Macro
Perfect! Thank you and Happy New Year
"Gary''s Student" wrote: Sub FI_killer() Application.DisplayAlerts = False For Each w In Worksheets If Left(w.Name, 2) = "FI" Then w.Delete End If Next Application.DisplayAlerts = True End Sub -- Gary''s Student - gsnu200822 "Indianagreg" wrote: I have a workbook with 500 tabs. 200 of the tabs are named: FI (1), FI (2), FI (3), etc. I want to delete all tabs that start with FI. I've tried the below without success - any suggestions? Here's what I have: Dim ws As Worksheet Application.DisplayAlerts = False For Each ws In Worksheets If ws.Name = "FI (*)" Then ws.Delete Next Application.DisplayAlerts = True |
Delete Selected Worksheets Macro
You too!
-- Gary''s Student - gsnu200822 "Indianagreg" wrote: Perfect! Thank you and Happy New Year "Gary''s Student" wrote: Sub FI_killer() Application.DisplayAlerts = False For Each w In Worksheets If Left(w.Name, 2) = "FI" Then w.Delete End If Next Application.DisplayAlerts = True End Sub -- Gary''s Student - gsnu200822 "Indianagreg" wrote: I have a workbook with 500 tabs. 200 of the tabs are named: FI (1), FI (2), FI (3), etc. I want to delete all tabs that start with FI. I've tried the below without success - any suggestions? Here's what I have: Dim ws As Worksheet Application.DisplayAlerts = False For Each ws In Worksheets If ws.Name = "FI (*)" Then ws.Delete Next Application.DisplayAlerts = True |
All times are GMT +1. The time now is 02:10 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com