Initiate Macro Formula :: Combo Boxes

L

lykwid

Hi,

I have a problem that I can resolve in two ways.

1) Is that I have a formula that will run a certain macro only if a
defined cell is a certain number. IE, if A1=1 then run macro1.. if A=2
then run macro2.. if A1=3 then run macro3.. etc

2) I have a combo box with 15+ options in. Is there a way that I can
assign a macro to the invidual options? Or to assign a function to be
carried out if a user clicks on a certain option?

If there is a way to do either of these, then I would be very grateful
if you could explain how. Otherwise, are there any other methods that
could possibly do the same thing?

The scenario is:

I have a combo box with X amount of activities that an organisation
offers. I want a user to navigate the spreadsheet using this combo box.
Clicking on the activity in the combo box will take the user to the
corressponding activity page.

Thanks in advance.
 
L

lykwid

Seems as though I worked out a method. If anyone has a similar problem,
I'll post how I did it.

I used a normal combo box which I assume you know how to do. I set the
cell link to G8, which display which option is selected in the combo
box.

I then created a button, which I used the caption of "Go" and placed it
next to the combo box.

The code I used for the button is:

Sub Button6_Click()

If Range("G8").Value = 1 Then
Sheets("Aerobics").Select
ElseIf Range("G8").Value = 2 Then
Sheets("Main").Select
ElseIf Range("G8").Value = 3 Then
Sheets("Members").Select
Else
End If

End Sub

---------------- below is explanation

Sub Button6_Click()

If Range("G8").Value = 1 Then
If the number 1 is in cell G8, then do the next line

Sheets("Aerobics").Select
Go to sheet called "Aerobics"

ElseIf Range("G8").Value = 2 Then
If the number 2 is in cell G8, then do the next line

Sheets("Main").Select
Go to sheet called "Main"

ElseIf Range("G8").Value = 3 Then
If the number 3 is in cell G8, then do the next line

Sheets("Members").Select
Go to sheet called "Members"

Else
End If

End Sub

This seems to work, although I have only just used it once.
 
Top