+ Reply to Thread
Results 1 to 5 of 5

Run the code on opening the userform

  1. #1
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Run the code on opening the userform

    Hi all,

    This I think will be a quick and simple one.

    I have several objects on a userform (textboxes, comboboxes etc.). They all depend on combobox1. If combobox1 is = "" all other objects are being locked and greyed out.

    Problem:

    When I load the userform, all objects are blank and active even if combobox1 is blank, but it only takes to type something in it and delete - code is then being executed. I need my code to execute when I actualy load userform.

    Any help please?

    Thanks!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,659

    Re: Run the code on opening the userform

    Please Login or Register  to view this content.
    This procedure automatically runs when the UserForm loads. Do not change the name of the procedure to the name of your userform.

    Alternatively, you could change the default Enabled property (= False ) of each control in the VBA Properties window.
    Last edited by AlphaFrog; 10-11-2015 at 10:05 AM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Run the code on opening the userform

    Hi again AlphaFrog,

    Thanks for the resonse. Where do I put this code? In ThisWorkbook? In Module? In one of the tabs?

    Sorry to be a pain, I'm still learning...

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,659

    Re: Run the code on opening the userform

    In the UserForm's code module.

  5. #5
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Run the code on opening the userform

    Good, as always.

    Thanks Alpha!

+ 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. VBA code for opening Hyperlink through Userform
    By phanikumarbh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-23-2015, 09:11 AM
  2. [SOLVED] Code error opening userform for data entry
    By dwheggen1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-10-2015, 02:14 PM
  3. Opening workbook from userform keeping userform at background..
    By cooldude113322 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-05-2012, 12:14 PM
  4. UserForm Not Opening
    By andrew c. in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-01-2011, 11:59 AM
  5. Code for Autopop-up Userform after Opening Workbook
    By macky1730 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2011, 10:01 AM
  6. [SOLVED] run code on opening workbook and apply code to certain sheets
    By Jane in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-08-2005, 05:05 AM
  7. Userform opening
    By mike in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2005, 02:05 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