View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
solomon_monkey[_2_] solomon_monkey[_2_] is offline
external usenet poster
 
Posts: 17
Default Naming vba Buttons

In very basic terms I have a spreadhseet with three sheets... I want a
user to be prompted to select 1 of the three sheets and each of the
three sheets will then require different code... I have the different
code but do not know how to get the suer to
select one of the three sheets...

My simple idea of code is thus...

Sub test()
result = MsgBox("Select Sheet", vbSheet1Sheet2Sheet3, "Banking")
If result = vbSheet1 Then
GoTo label1
Else
If result = vbSheet2 Then
GoTo label2
Else
If result = vbSheet3 Then
GoTo label3
End If
End If
End If

label1:
'Some code here
label2:
'Some code here
label3:
'Some code here

End Sub

I've worked out that it's not as simple as I would like it to be... but
can't use logic to work out the other way around... any ideas?

Many many thanks to you fine people...

Will