Selecting Worksheets

colinh

Board Regular
Joined
Dec 2, 2010
Messages
60
Hi All
Need a bit of code I have a workbook with 100 odd worksheets on is there a way of selecting or activating a worksheet by typing in a number in a cell on sheet 1?

So to sum up if sheet1 cell A1 I enter 52 we automaticaly jump to worksheet 52. I can use a userform or something if needed I just need the code for jumping to the chosen worksheet.

Thanks a mil

Colin
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Are the worksheets named like "Sheet1", "Sheet2", ..., "Sheet54", etc?

Or are you just wanting it to jump to the worksheet index that you tell it to? (Note, the worksheet index does not necessarily mean the order they are in the tabs)
 
Upvote 0
Try this
Put this in your "sheet1" module
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 1 And Target.Row = 1 Then Worksheets("Sheet" & Target.Value).Select
End Sub
 
Upvote 0
Colin

You could try this in the Sheet1 module.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$1" Then
         Application.Goto Worksheets(CStr(Target.Value)).Range("A1"), True
    End If
End Sub
 
Upvote 0
kpark

It's perhaps more common to use Column and Row, or Intersect to check that Target is located within the range of interest.

Especially if you are dealing with multiple cells/ranges.
 
Upvote 0

Forum statistics

Threads
1,224,605
Messages
6,179,860
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top