I need some help with a code that checks if there is a sheet name and if there is a sheet of that name then it is deleted.
the sheet name is a number entered through an inputbox and "Average"
![]()
Please Login or Register to view this content.
I need some help with a code that checks if there is a sheet name and if there is a sheet of that name then it is deleted.
the sheet name is a number entered through an inputbox and "Average"
![]()
Please Login or Register to view this content.
Last edited by christo; 07-09-2008 at 08:26 PM.
Please read the Forum Rules and then wrap your code with Code Tags.
try this simple one: if (thisworkbook.sheets(index).name = "name" then thisworkbook.sheets(index).delete
I made some VBA programs to compare two sheets, delete blanks in rows and columns, read huge txt file and csv file into excel, advanced search and replace (search cell value larger or less than a value, and search string), and multiple goal seek. if you are interested in it, contact me xgncjx@yahoo.com
Thanks shg
I forgot to add the code tags
Thank you.
I'm confused by Average and Cumulative; are there two sheets to delete or one?
![]()
Please Login or Register to view this content.
There is only one sheet of a graph there was an error in the code I posted
it should have been
![]()
Please Login or Register to view this content.
You don't show where plantnumber is set, but that's essentially how mine works -- try it and post back.
I tried your code and it returned
the code returned error 9 "subscript out of range"![]()
Please Login or Register to view this content.
when it got to this line in the code
the plant number was PW701 and the sheet name was PW701Average![]()
Please Login or Register to view this content.
there was a worksheet with this name
Will this code work without the end sub as I need the code in the middle of a sub
Last edited by christo; 07-09-2008 at 09:08 PM.
worksheet or chart sheet?
If it was a chartsheet, change
to![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
That worked thank you for your help
Great, you're welcome.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks