+ Reply to Thread
Results 1 to 4 of 4

Adding new sheet to existing userform

  1. #1
    Registered User
    Join Date
    02-18-2013
    Location
    Germantown, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Adding new sheet to existing userform

    Hello!

    Nickmax1 helped me out last week with some coding so my users had to choose between 2 combo boxes to go to the desired worksheet. I've attached the Test workbook he created. I had no problems adding "Construction MD" and Construction Repair", but I can't add "Exempt". I get a "run-time error 9" and "subcript out of range". If I click "Debug", it takes me to VBA and highlights
    ThisWorkbook.Worksheets(strWS).Visible = True

    I added my workbook with the hopes that you can figure out what I've done as I'm assuming it's something horribly wrong!! Any suggestions??

    Thanks!!!!
    Attached Files Attached Files

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Adding new sheet to existing userform

    The worksheet that is selected when you click the button is determined by concatenating the values from the two combo boxes

    Please Login or Register  to view this content.
    You state you want to add Exempt, my question is: to which combo box?

    Assuming combo box 1: then I would expect to see worksheets in your workbook with names 'Exempt DC', 'Exempt VA' and 'Exempt MD'. These worksheets do not exist hence the error message
    If you like my contribution click the star icon!

  3. #3
    Registered User
    Join Date
    02-18-2013
    Location
    Germantown, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Adding new sheet to existing userform

    Well, I want to add "Exempt" to combobox 1, and then a worksheet called "ALL" for combobox 2. Right now, they need to choose between "Repair" and "Construction", and I want to give them a third option, "Exempt". Then I want a totally different spreadsheet added that will not have taxes apply to anything. So I've been trying "Exempt" in Combobox 1 and "All" in Combobox 2, and I did create a spreadsheet called "All". Basically, all of the taxes will apply to a tax exempt customer, no matter the jurisdication, so I don't need DC, MD and VA choices.

  4. #4
    Registered User
    Join Date
    02-18-2013
    Location
    Germantown, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Adding new sheet to existing userform

    AH! I figured it out! I needed to call the worksheet "Exempt All". Thanks for your help!!!

+ 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