+ Reply to Thread
Results 1 to 5 of 5

Activating worksheet after pressing button on userform

  1. #1
    Registered User
    Join Date
    11-04-2006
    Posts
    30

    Activating worksheet after pressing button on userform

    I'm sure this is probably simple and I am just missing something that is right under my nose.

    I have created a userform that I am starting when the workbook is opened. I am using the frmName.Show False command to open the form. I have also disabled the closing of the form when the user hits the X because I want this form to always stay open.

    I have a button on the user form that calls a macro to sort the data in my spreadsheet. What I would like to happen after the button is pressed and the macro finishes is to return control to the worksheet, rather than the form.

    Thanks for the help. I am sure that I am missing something simple.

  2. #2
    Forum Contributor stevebriz's Avatar
    Join Date
    09-07-2006
    Location
    Santiago Chile
    Posts
    389
    Did your try putting
    unload frmName
    at the end of your macro

    by putting frmName.Show False this means that while the form is shown you can still edit the worksheet. is this what you want?
    VBA - The Power Behind the Grid

    Posting a sample of your workbook makes it easier to look at the Issue.

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    Please Login or Register  to view this content.
    you can hide the form, then it stays in memeory, and will show faster when you want to bring it up again, when you hide the UserForm though, it doesn't reset itself, if you need it to be reset, you would have to unload it, like the above post suggests

  4. #4
    Registered User
    Join Date
    11-04-2006
    Posts
    30
    Thanks for the replies, however, I do not want the userform to disappear. The userform just contains a number of buttons that call different macros. I know I could just put the macros button on the menu, but with the userforms, I can have each button the same size, I can give a little more information, and I can easily put multiple rows.

    So, for example, if the user wants to add a row, they will click on the add row button which should add a row, and then put the user on the first enterable column of the row (which the macro does, but the user form actually still has the focus). If the user wants to delete a row, they would just click on a cell in that row, and then click the delete button (which runs a macro to determine if they can delete the row). Again, after the macro runs, it should put them back on the spreadsheet on the next run.

    Again, I don't want to hide or unload the userform. I just don't want the userform to have the focus so that the user can just start typing after they pushed one of the buttons.

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    Just select your UserForm and then change the "ShowModal" (in the Properties Window) to False.

+ 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