Place Name of Sheet in Variable for Use

  • Thread starter Thread starter Larry R Harrison Jr
  • Start date Start date
L

Larry R Harrison Jr

I have Excel XP. I am trying to modify the following statement:

Sheets("name").Select

with something like

Sheets(variable).Select

I do have a variable name with the filename in it; simply parcing out the
last 4 characters ".txt" would give this name. But that done, I can't seem
to get the right variable type, declarations etc to get this to function.

Tips?

LRH
 
Larry

Sub SelectSheet()
Dim sSheetName As String
sSheetName = "Import Text To Excel"
Sheets(sSheetName).Select
End Sub

Regards

Trevor
 
Back
Top