Using VBA in Excel to locate a sheet
Sub foo()
Dim MySheet As String
On Error GoTo errhandler
MySheet = Range("A1").Value
Worksheets(MySheet).Activate
Exit Sub
errhandler:
MsgBox "There is no worksheet by this name"
End Sub
" wrote in
message oups.com:
I want to set up a code to read the contents of a cell and locate the
sheet that matches what's in the cell. For example, if the cell reads
"Home", I want it to locate and open the worksheet named Home. How do
I do this?
|