Results 1 to 7 of 7

Thread: [RESOLVED] Button to Excel Worksheet VBA

  1. #1

    Thread Starter
    Fanatic Member mateo107's Avatar
    Join Date
    Jan 2005
    Posts
    547

    Resolved [RESOLVED] Button to Excel Worksheet VBA

    I've got a form that auto loads when my spreadsheet opens. The problem is that this form can be closed or x-ed out, and the only way for it to return is to close and reopen the spreadsheet.

    Is there any way that I can add a button to my spreadsheet which would reopen this form?

    Thanks!

    I'm a complete n00b so i apologize if this is Excel VBA 101 stuff.


    -Matthew-

  2. #2
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Button to Excel Worksheet VBA

    Sure
    Add a command button and in its click event you cal create and display an instance of the form.
    You will need to change 'UserForm1' to the name of your form.

    VB Code:
    1. Private Sub CommandButton1_Click()
    2. Dim frmStartUpForm As UserForm1
    3.  
    4.     Set frmStartUpForm = New UserForm1
    5.     frmStartUpForm.Show
    6.     'etc
    7.     'etc
    8.    
    9.     Set frmStartUpForm = Nothing
    10. End Sub
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  3. #3

    Thread Starter
    Fanatic Member mateo107's Avatar
    Join Date
    Jan 2005
    Posts
    547

    Re: Button to Excel Worksheet VBA

    thanks... i'm looking through excel, and I can't seem to find the option to add a command button to my worksheet...

    am I missing something?


    -Matthew-

  4. #4
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Button to Excel Worksheet VBA

    -->View-->Toolbars-->Control Toolbox
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  5. #5
    Addicted Member
    Join Date
    Jan 2006
    Location
    Montreal, Canada
    Posts
    152

    Re: Button to Excel Worksheet VBA

    Right click on the toolbar and check the control toolbox option

    then you're gonna have all you need to design including button

  6. #6
    Addicted Member
    Join Date
    Jan 2006
    Location
    Montreal, Canada
    Posts
    152

    Re: Button to Excel Worksheet VBA

    too slow on the trigger

  7. #7

    Thread Starter
    Fanatic Member mateo107's Avatar
    Join Date
    Jan 2005
    Posts
    547

    Re: Button to Excel Worksheet VBA

    yah... i was just being a moron... i figured it out.... :-\ thanks for supporting my lack of brain function :-D


    -Matthew-

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width