View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Naming vba Buttons

Maybe

Private Sub Workbook_Open()
Dim ans
ans=MsgBox("Supply a value from this list" & vbCrLf & _
"Sheet1, Sheet2, Sheet3")
Select Case ans
Case "Sheet1":
'sheet 1 code
Case "Sheet2":
'sheet 2 code
Case "Sheet3":
'sheet 3 code
End Select
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code

--

HTH

RP
(remove nothere from the email address if mailing direct)


"solomon_monkey" wrote in message
ups.com...
Nice idea but the code need not run every time the sheet is selected.

How do you set it up so when the spreadsheet is selected it runs the
code?

What other solution would you suggest?

Thanks again...