View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Opening a worksheet with a button?

in design mode, double click on the button to get to the click event in the
code module of the sheet where the button is located. Or in any mode, right
click on the sheet tab and select view code, then( at the top of the
module) in the left dropdown select CommandButton1 and in the right select
Click

Private Sub CommandButton1_Click( )

End Sub

should be entered in the module. Put in code something like this untested
pseudo code.


Private Sub CommandButton1_Click()
Dim wkbk as workbook
On Error Resume Next
set wkbk = Workbooks("Data Table.xls")
On Error goto 0
if wkbk is nothing then
Workbooks.Open ThisWorkbook.Path & "\Data Table.xls"
ThisWorkbook.Activate
End if
End Sub

Regards,
Tom Ogilvy

"joe" wrote in message
...
Hi Everybody:

I have 2 worksheets in a workbook. One acts like a main
menu and the other is like the data table. I created a
button in the main menu...but i'm stuck. My question is
how do I code the command button to open up that other
worksheet(data table)?

Joe