+ Reply to Thread
Results 1 to 11 of 11

Display worksheet from Userform procedure

  1. #1
    Registered User
    Join Date
    07-13-2011
    Location
    Boston, MA USA
    MS-Off Ver
    Excel 2010
    Posts
    28

    Display worksheet from Userform procedure

    I'm learning VBA from books and the internet. Forgive me if this is really dumb question.

    I'm developing a VBA application consisting of numerous Userforms, and my data exists on several worksheets within the same workbook. In some cases, I want to navigate from a userform to a protected worksheet where the user can double-click to select some codes from a complex table. The user can return to the Userform by double-clicking a specfic cell and the selected codes from the worksheet are then processed in Userform procedures. Most of this works fine.
    My problem: I can't find a way to actually show the worksheet. In testing, I've hit Alt F11 to get to the worksheet. I use a command button on the Userform (frmSHLDRProc) and the following code to try to show a worksheet named Table15-5...
    Please Login or Register  to view this content.
    Am I way off base? How do I show the worksheet. Returning to the Userform works fine.
    Thanks for any help.
    Last edited by bdoodle; 11-10-2011 at 06:35 PM.

  2. #2
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: How display worksheet from Userform procedure

    hi,
    not sure I got it but I use a UserForm and for navigate I use OptionButtons.
    it's just an idea...!
    Please Login or Register  to view this content.
    and OptionButton2
    Please Login or Register  to view this content.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  3. #3
    Registered User
    Join Date
    07-13-2011
    Location
    Boston, MA USA
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: How display worksheet from Userform procedure

    Thanks, John.
    I noticed that you used the following statement that I didn't have:
    Sheets("As2").Visible = 1
    I added something comparable to my code for my particular sheet. It behaved no differently when I tested it.
    FYI, My command button works the SECOND time it is hit. ie. The first time I hit it, nothing happens so I hit alt F11 to get to the worksheet. I return to the Userform from the worksheet and then hit the command button again, and it works... it shows the worksheet.
    I'm still at a loss!

  4. #4
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: How display worksheet from Userform procedure

    when I hit optionbutton 1 I have Sheet As1 visible only (I am in) , Sheets As2 and Inf are not.
    when I hit optionbutton 2 I have Sheet As2 visible only (I am in) , Sheets As1 and Inf are not and so on.
    the optionbuttons are in UserForm. I use only one.

  5. #5
    Registered User
    Join Date
    07-13-2011
    Location
    Boston, MA USA
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: How display worksheet from Userform procedure

    Thanks for sticking with me, John.
    I think I understand your use of option buttons, but...
    Did I make it clear that when I hit the command button the first time, it hides my Userform and I see VBA code... no worksheets?
    It's not that I see the wrong worksheet or too many worksheets. I see no worksheet! I'm reluctant to convert to using the option button, when the fundamental problem would not seem to be addressed by doing so. The code to make the sheet visible is not working.

  6. #6
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: How display worksheet from Userform procedure

    see if it helps you (updated) and try to modify for yr needs...
    Attached Files Attached Files
    Last edited by john55; 11-10-2011 at 05:43 PM.

  7. #7
    Registered User
    Join Date
    07-13-2011
    Location
    Boston, MA USA
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: How display worksheet from Userform procedure

    Thanks for the sample. I'm sure I'll use something similar at some point for a similar need.
    But, bear with me one more time, John.
    You start by showing a worksheet and then showing a userform that you use to govern the visibility of each worksheet after that.
    I start with a splash screen that after 5 seconds shows a Userform. No worksheet is shown until I try to do so with my command button. How do I get that first worksheet to appear?

  8. #8
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: How display worksheet from Userform procedure

    try to check what code you have in
    Please Login or Register  to view this content.
    I think the excel starts with the default sheet if you have nothing in the "Workbook_Open()"

  9. #9
    Registered User
    Join Date
    07-13-2011
    Location
    Boston, MA USA
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: How display worksheet from Userform procedure

    thanks for all the help, John!

  10. #10
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Display worksheet from Userform procedure

    k, you're welcome!

  11. #11
    Registered User
    Join Date
    11-10-2012
    Location
    kolkata
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: How display worksheet from Userform procedure

    Thanks your _testw file really solved my problem....

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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