Command button and linking with other sheets in the workbooks

K

Ken Vo

I am trying to make a command button that if clicked will jump the user to
another sheet and/or file. (e.g. if "Inspection" button is clicked it will
jump to the Inspection sheet in the same workbook. Help me please. Thanks!
 
N

Norman Jones

Hi Ken,

Try:

'=============>>
Private Sub CommandButton1_Click()
Dim WB As Workbook
Dim SH As Worksheet

Set WB = ThisWorkbook
Set SH = WB.Sheets("Inspection")
SH.Activate
End Sub
'<<=============

To activate a sheet in another (open) workbook, replace:


Set WB = ThisWorkbook

with

SetWB = Workbooks("OtherWorkbook.xls")
 
K

Ken Vo

Thanks for your help Norman, but it didnt work.

Norman Jones said:
Hi Ken,

Try:

'=============>>
Private Sub CommandButton1_Click()
Dim WB As Workbook
Dim SH As Worksheet

Set WB = ThisWorkbook
Set SH = WB.Sheets("Inspection")
SH.Activate
End Sub
'<<=============

To activate a sheet in another (open) workbook, replace:


Set WB = ThisWorkbook

with

SetWB = Workbooks("OtherWorkbook.xls")
 
Top