+ Reply to Thread
Results 1 to 9 of 9

Using a worksheet command button to start userform initialize procedures

  1. #1
    Registered User
    Join Date
    10-25-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    65

    Using a worksheet command button to start userform initialize procedures

    Hello,

    I previously created a worksheet with a command button which had the code
    Please Login or Register  to view this content.
    . The userform had a procedure under
    Please Login or Register  to view this content.
    . When I clicked the command button on the worksheet it opened the form in the way instructed under the initialize procedures.

    I am creating almost the same thing but the code no longer works. When I use the
    Please Login or Register  to view this content.
    , it shows the form but does not open it as per the initialize procedures.

    How can I get a command button that is on a worksheet to start the initialize procedures of a userform? And why did it work the first time but not again?

    stuck???

    Help appreciated

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Using a worksheet command button to start userform initialize procedures

    Have you changed anything?

    Perhaps the name of the Initialize event.
    If posting code please use code tags, see here.

  3. #3
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Using a worksheet command button to start userform initialize procedures

    Hello paulary30,

    Did you perhaps added another UserForm? If so, refer to the actual UserForm you want to open or show via the Command Button.

    Alternatively, upload a sample WorkBook of your problem, complete with your code and UserForm/s, for us to have a look at.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  4. #4
    Registered User
    Join Date
    10-25-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    65

    Re: Using a worksheet command button to start userform initialize procedures

    Quote Originally Posted by Norie View Post
    Have you changed anything?

    Perhaps the name of the Initialize event.
    I have changed everything as i am working on a completely new project, however I have used the same method i.e placing a command button on the worksheet and then using the code as stated above.

    I know that the initialize event works as when I place a command button on the userform to trigger the initialize event it works fine.

    The problem seems that the command button on the spreadsheet cannot "read" the initialize event on the userform.

    Do I need to put something on a module?

  5. #5
    Registered User
    Join Date
    10-25-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    65

    Re: Using a worksheet command button to start userform initialize procedures

    Quote Originally Posted by Winon View Post
    Hello paulary30,

    Did you perhaps added another UserForm? If so, refer to the actual UserForm you want to open or show via the Command Button.

    Alternatively, upload a sample WorkBook of your problem, complete with your code and UserForm/s, for us to have a look at.
    I am unable to send my example as it is a huge spreadsheet and has sensitive information re my work on it.

    I created a dummy spreadsheet with a command button and a userform and that seemed to work. I am stumped!

    Do procedures have to be in certain orders?

  6. #6
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Using a worksheet command button to start userform initialize procedures

    Hello paulary30,

    Do procedures have to be in certain orders?
    Yes, preferably.

    Try deleting the CommandButton for the UserForm, and replace it with another.

  7. #7
    Registered User
    Join Date
    10-25-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    65

    Re: Using a worksheet command button to start userform initialize procedures

    Tried that and it still would not work. It shows the form but I have to press another button (which is on the form) to get the initialize events to start.

    I am v frustrated

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Using a worksheet command button to start userform initialize procedures

    Can you post the exact code for the Initialize event?

  9. #9
    Registered User
    Join Date
    10-25-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    65

    Re: Using a worksheet command button to start userform initialize procedures

    For some strange reason it is now working on one of my forms and not the other. I have just moved the order about. I will try to do the same with the other.

+ 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