Unanswered: Searching a list for a reference to use to select a worksheet
Hi, I'm using the following code to try and match a cell to a corresponding worksheet.
The name in the cell doesn't always match the worksheet name so I have a list to find the name in the cell and offset it by one column to get the name of the worksheet to use.
If Trim(StName) <> "" Then
Set Rnge = .Find(What:=StName, _
If Not Rnge Is Nothing Then
Application.Goto Rnge.Offset(0, 1), True
Set NameCell = Rnge.Offset(0, 1)
Set Name = Sheets("NameCell")
The code works and selects the correct cell in the list using the offset, but I need to get the value in that cell to select the correct worksheet but it doesn't like Set Name = Sheets("NameCell")
You haven't shown any dimention statements so we don't know what is what, I hope you are using Option Explicit at the top of the module!?
I assume NameCell is a range object. If so, that is not necessary.
Dim ShtName as String
ShtName = Rnge.Offest(0,1)