Goto Tab

E

Ed Davis

Is there a way for a macro to goto a Tab that is listed in a cel.
Example:

A5 has the name Jay and I want to goto the Jay tab.

Thanks in advance
 
C

Chip Pearson

Ed,

Try code like

On Error Resume Next
With ThisWorkbook.Worksheets
.Item(.Item("Sheet1").Range("A5").Value).Select
End With
If Err.Number <> 0 Then
MsgBox Err.Description
End If

It reads the contents of A5 on Sheet1 and activates the sheet named in that
cell.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
E

Ed Davis

This workes great.
Thank You


Chip Pearson said:
Ed,

Try code like

On Error Resume Next
With ThisWorkbook.Worksheets
.Item(.Item("Sheet1").Range("A5").Value).Select
End With
If Err.Number <> 0 Then
MsgBox Err.Description
End If

It reads the contents of A5 on Sheet1 and activates the sheet named in
that cell.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
R

Rick Rothstein

I know the OP has an answer, but I wanted to post (for the archives) a
method that does not require error checking...

Dim WS As Worksheet
For Each WS In Worksheets
If WS.Name = Worksheets("Sheet1").Range("A5").Value Then
WS.Select
Exit For
End If
Next
 
Top