Excel, forms and macros

  [DELETED] 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!!

  [DELETED] 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)

  [DELETED] 09:27 07 Nov 2003

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.

  [DELETED] 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

Microsoft Surface Book 2 15in review

The humble pint glass is redesigned from bottoms up by design legend Sir Kenneth Grange

The best Amazon Prime Day Apple deals 2018

Les meilleures coques pour iPhone X (2018)