+ Reply to Thread
Results 1 to 9 of 9

Activating a userform at end of code

  1. #1
    Registered User
    Join Date
    04-28-2014
    Location
    Sverige
    MS-Off Ver
    Excel 2007
    Posts
    17

    Activating a userform at end of code

    Hi,

    I have made a userform (in WB1) that opens a closed workbook (WB2) and copies some cell values into text boxes in the userform. When running the macro everything works just fine but at the end it activates WB2 instead of showing the userform. I can't seem to wb1.activate since the userform is open and I don't want to close WB2 since I need it for a later step in the unserform.

    I have tried with turning of screenupdating but that does not seem to do the trick either. Would greatly appreciate any help!

    Best

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Activating a userform at end of code

    You may have to post the code you are using so we can help you out.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,986

    Re: Activating a userform at end of code

    .
    Sounds like you want to have WB2.Visible = False ?

    Post your code please.

  4. #4
    Registered User
    Join Date
    04-28-2014
    Location
    Sverige
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Activating a userform at end of code

    Hi, thanks for the help!

    Please see code below

    Please Login or Register  to view this content.
    Thanks!

  5. #5
    Registered User
    Join Date
    04-28-2014
    Location
    Sverige
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Activating a userform at end of code

    Any ideas on how to make sure the user sees WB1 (and the userform) at the end of the code? Currently the userform allows the user to pick a file, from which some data is retrieved and populated in the userform. It then activates WB2.

    Thanks in advance!

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Activating a userform at end of code

    Hi Hokkaido

    I may be wrong but would you not want to Activate wb1 at end of code and then show UserForm...
    Difficult without your workbook...Something like this?
    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  7. #7
    Forum Contributor
    Join Date
    01-02-2007
    Location
    Australia NSW
    MS-Off Ver
    2013
    Posts
    494

    Re: Activating a userform at end of code

    I agree with sintek, you need to use
    Please Login or Register  to view this content.
    to set the wkb as the visible one.
    Use at the end of your code as the last line before Application.ScreenUpdating= True.

  8. #8
    Registered User
    Join Date
    04-28-2014
    Location
    Sverige
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Activating a userform at end of code

    Thanks guys. For some reason it doesn't want to activate wb1 (the one containing the userform). I now did a windowstate=xlminimized that kind of solves the problem. At least wb2 doesn't show now.

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Activating a userform at end of code

    Any chance for a sample upload

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Userform loses focus after activating another workbook
    By quekbc in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-13-2020, 04:07 PM
  2. Activating a UserForm TextBox
    By aca in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-25-2011, 04:05 PM
  3. activating userform without showing workbook
    By dan2010 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-24-2010, 03:52 AM
  4. Activating Worksheet after Loading Modeless UserForm
    By jasoncw in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-08-2008, 09:15 PM
  5. Activating worksheet after pressing button on userform
    By vbace2 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-11-2006, 10:06 AM
  6. code to prompt before activating changes
    By mhmaid in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 08-17-2005, 10:04 PM
  7. [SOLVED] Activating userform and filling it with data form row where userform is activate
    By Marthijn Beusekom via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-06-2005, 01:06 PM

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