+ Reply to Thread
Results 1 to 13 of 13

Assign UserForm to a CommandButton

  1. #1
    Registered User
    Join Date
    09-22-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2003
    Posts
    20

    Assign UserForm to a CommandButton

    Aim/Object How can I assign a userform with 'Log-in' and 'Log-off' options to every employee name's command button? so that whenever I click on any employee's name (CommandButton1 or CommandButton4) I can get a pop-up message box which has two another CommandButtons options - 'Log-in' and 'Log-off'.
    This is how I will be able to noted (record) the 'Log-in & 'Log-off' time by a single button, and have a better appearance too.

    Note - I made a userform with 'Log-in' & 'Log-off' CommandButtons, but whenever I go to the VBA window by 'Alt+F11' then only I was able to see that by pressing 'F5' button, but none of CommandButton worked at all, otherwise in this case I have to make another CommandButton to record 'Log-off' time for every employee, which is not so cool in the appearance.


    Please Help me out!

    Thanks in Advance!

    Note - Kindly look in to the new updated workbook for more convenience, I've just inserted a userform too.
    Attached Files Attached Files
    Last edited by SunOffice024; 09-26-2010 at 06:59 AM.

  2. #2
    Registered User
    Join Date
    09-22-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Assign UserForm to a CommandButton

    Thanks Mr. pike!

    The workbook is updated now!

    I've stated the problem and wht solution/ help I'm looking for. I've tried my times. I am able to make a userform and commandbuttons, you can see in the workbook, but i'm still unable to connect a userform to a commandbutton, so if I click on a commandbutton then the userform should automatically pop-up, then only I would able to use another commandbuttons - 'Log-in' and 'Log-off'

    Kindly help me!

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,327

    Re: Assign UserForm to a CommandButton

    Hi SunOffice024
    the first step - add another commandbutton to the worksheet and add this code
    Please Login or Register  to view this content.
    this will show the userform
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  4. #4
    Registered User
    Join Date
    09-22-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Assign UserForm to a CommandButton

    Thanks a world man!

    The idea & codes are working fine at their place, but when I add one more commandbutton in the userform - 'Turn Off', then how can I close the userform window just by clicking on this 'Turn Off' option?

    Plz look into this query too.

    Thanks in Advance!

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,202

    Re: Assign UserForm to a CommandButton

    The code in the new button click event would be
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,327

    Re: Assign UserForm to a CommandButton

    Hi SunOffice024
    one possible way would be to find the name of the employee.
    you could add a combobox to your userform with the all the names

  7. #7
    Registered User
    Join Date
    09-22-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Assign UserForm to a CommandButton

    WOW!! It works fine! Thanks alot Mr royUK!

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,327

    Re: Assign UserForm to a CommandButton

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  9. #9
    Registered User
    Join Date
    09-22-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Assign UserForm to a CommandButton

    hey guys it's solved, and I'm going to get some more knowledge abt ComboBox.

  10. #10
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,327

    Re: Assign UserForm to a CommandButton

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  11. #11
    Registered User
    Join Date
    09-22-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Assign UserForm to a CommandButton

    Done! Thanks!

  12. #12
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,327

    Re: Assign UserForm to a CommandButton

    Thanks for taking the time to read and comply with the rule .

  13. #13
    Registered User
    Join Date
    09-22-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Assign UserForm to a CommandButton

    Haha...!

+ 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