![]() |
Using VBA in Excel to locate a sheet
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? |
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? |
All times are GMT +1. The time now is 02:01 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com