UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Delete Worksheet With Sam Name, Office 2010    
 
   
wornout
post May 9 2019, 05:22 PM
Post#1



Posts: 1,299
Joined: 17-November 13
From: Orewa New Zealand


I have a list of worksheets in the "index"(Sheet14) sheet in column A1
when I select one of the worksheet Names in the list I would like it to delete that worksheet on button click or if I click on B1 it will delete all the sheets except the "Index" sheet(sheet14) on button click
Go to the top of the page
 
Debaser
post May 10 2019, 02:10 AM
Post#2



Posts: 121
Joined: 11-October 18



Something like this:

CODE
application.displayalerts = false
If activecell.address = "$B$1" then
dim sh as object
for each sh in thisworkbook.sheets
   if not sh is sheet14 then sh.delete
next sh
else
on error resume next
thisworkbook.sheets(Cstr(activecell.value)).Delete
on error goto 0
end if
application.displayalerts = true
Go to the top of the page
 
wornout
post May 11 2019, 03:08 PM
Post#3



Posts: 1,299
Joined: 17-November 13
From: Orewa New Zealand


Thank you so much that worked. I kept deleting all the sheets and could not seem to match the cell value to the sheet name now I see how you did it thumbup.gif
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    19th June 2019 - 05:59 AM