ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   deleting worksheets from names in a range (https://www.excelbanter.com/excel-discussion-misc-queries/41680-deleting-worksheets-names-range.html)

Jenn

deleting worksheets from names in a range
 
Is there anyway to delete worksheets via code where one worksheet contains a
range with the names of the tabs on the worksheets I want to delete?
i.e., Sheet 1 has a range that has the values, A, B, C.
These are the names on tabs for 3 worksheets. I want to have code that says
"delete worksheets with the tabs named A, B, C.
Let me know if you need more info.
TIA!

Bob Phillips


With Worksheets("Sheet1")
Application.DisplayAlaerts = False
For i = 1 To Cells(Rows.Count,"A").End(xlUp).Row
On Error Resume Next
Worksheets(Cells(i,"A").Value).Delete
On Error Goto 0
Next i
Application.DisplayAlerts = True
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jenn" wrote in message
...
Is there anyway to delete worksheets via code where one worksheet contains

a
range with the names of the tabs on the worksheets I want to delete?
i.e., Sheet 1 has a range that has the values, A, B, C.
These are the names on tabs for 3 worksheets. I want to have code that

says
"delete worksheets with the tabs named A, B, C.
Let me know if you need more info.
TIA!




CyberTaz

Why not just Ctrl+Click the tabs and use EditDelete Sheet?

Regards |:)




On 8/22/05 5:08 PM, in article
, "Jenn"
wrote:

Is there anyway to delete worksheets via code where one worksheet contains a
range with the names of the tabs on the worksheets I want to delete?
i.e., Sheet 1 has a range that has the values, A, B, C.
These are the names on tabs for 3 worksheets. I want to have code that says
"delete worksheets with the tabs named A, B, C.
Let me know if you need more info.
TIA!




All times are GMT +1. The time now is 10:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com