Excel, forms and macros

  Bramblerose 08:34 07 Nov 2003

Hi there,

I am very slowing learning how to create a database in Excel. I know it should be done in Access but thats just not feasible for me.

Anyway, I have an very good example of something a colleague of mine did and I am now trying to create something similar.

What I need to do is create an "options" button so that when it is clicked a series of options are displayed.

I have made the form using the VB editor but I don;t know now how to put the form into the spreadsheet!

Can someone please advise - simply please!!

  rogertjj 08:47 07 Nov 2003

in Excel, create a button, using the 'Forms' toolbar. It will then ask you which macro you want to assign to the button. Click on the 'New' option, and VB editor will open with something like the following:

Sub Button1_Click()

End Sub

In between these two lines, type :

UserForm1.Show (replace UserForm1 with the name of the form you have created)

There are many ways in which the Form can be shown but they all rely on the one piece of code shown by rogertjj


If you want the form to automatically show when the workbook is opened then that line of code would go onto the 'This workbook' sheet.

In the VBE doubleclick on the words 'This workbook' in the Project window, this will bring up the code sheet for the workbook.

At the top of the workbook code sheet there are 2 slotted windows, click in the left one and select Workbook, a snippet of code will then appear below. In between the two lines of code type the line Userform1.show, the result should look like this:

Private Sub Workbook_Open()


End Sub

If you now save the workbook, close it, and then reopen it your form will now be available for you.

  Bramblerose 09:33 07 Nov 2003

OK.. that worked thank you... I now need to make the buttons on the options list work now!!

I will go and study the VB code behind the example I have to see if I can get it working - if not, I will post back later.

Thank you !

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Moto G6 Play Review: First Look

iPad 9.7in (2018) review

Comment utiliser Live Photos ?