Goto Tab

  • Thread starter Thread starter Ed Davis
  • Start date Start date
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
 
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)
 
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)
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top