Select sheet by name in cell


Posted by Phil Ridley on July 10, 2001 6:41 PM

Hi everyone.
I want to select a sheet in a workbook based on the contents of a cell. Eg: I have a sheet called "Test" in a workbook. I enter "Test" as text into a cell on another sheet and run the macro and it makes the sheet "Test" active.

I thought it would be something like this:
ActiveSheet.Select = Sheets("Other").[A1].Value
but it does not work. Any hints ?

Thanks,
Phil.

Posted by Phil on July 10, 2001 6:56 PM

I came up with a clumsy solution. Is there a one liner to do this ?

Sub Selector()
Dim sheet_name As String
sheet_name = Sheets("Core").[A4].Value
Sheets(sheet_name).Select
End Sub

Phil.



Posted by Damon Ostrander on July 10, 2001 9:52 PM

Phil,

How about:

Sheets([A1]).Activate

Cheers.

Damon