+ Reply to Thread
Results 1 to 11 of 11

Deleting sheets

  1. #1
    Registered User
    Join Date
    06-27-2008
    Location
    brisbane
    Posts
    23

    Deleting sheets

    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.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Please read the Forum Rules and then wrap your code with Code Tags.

  3. #3
    Registered User
    Join Date
    07-09-2008
    Location
    NY
    Posts
    2

    VBA program to compare two sheets,delete blanks,advanced search, multiple goal seek

    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

  4. #4
    Registered User
    Join Date
    06-27-2008
    Location
    brisbane
    Posts
    23
    Thanks shg
    I forgot to add the code tags

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    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.

  6. #6
    Registered User
    Join Date
    06-27-2008
    Location
    brisbane
    Posts
    23

    correct code

    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.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    You don't show where plantnumber is set, but that's essentially how mine works -- try it and post back.

  8. #8
    Registered User
    Join Date
    06-27-2008
    Location
    brisbane
    Posts
    23

    Code didn't work

    I tried your code and it returned

    Please Login or Register  to view this content.
    the code returned error 9 "subscript out of range"
    when it got to this line in the code
    Please Login or Register  to view this content.
    the plant number was PW701 and the sheet name was PW701Average

    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.

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    worksheet or chart sheet?

    If it was a chartsheet, change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    06-27-2008
    Location
    brisbane
    Posts
    23

    Thank you that worked

    That worked thank you for your help

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Great, you're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1