PDA

Click to See Complete Forum and Search --> : [RESOLVED] Button to Excel Worksheet VBA


mateo107
Mar 7th, 2006, 02:42 PM
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.

DKenny
Mar 7th, 2006, 02:47 PM
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.

Private Sub CommandButton1_Click()
Dim frmStartUpForm As UserForm1

Set frmStartUpForm = New UserForm1
frmStartUpForm.Show
'etc
'etc

Set frmStartUpForm = Nothing
End Sub

mateo107
Mar 7th, 2006, 03:10 PM
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?

DKenny
Mar 7th, 2006, 03:11 PM
-->View-->Toolbars-->Control Toolbox

billhuard
Mar 7th, 2006, 03:13 PM
Right click on the toolbar and check the control toolbox option

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

billhuard
Mar 7th, 2006, 03:14 PM
too slow on the trigger :cool:

mateo107
Mar 7th, 2006, 03:31 PM
yah... i was just being a moron... i figured it out.... :-\ thanks for supporting my lack of brain function :-D