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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top