creating a value for a file name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello is it possible to create a variable for a file name:
for example x.xls where x=cell A1
I am trying to create a vlook up formula that can access differnt xls files
=vlookup([x.xls]!,A2:A4,2) something like that
I can't get x to be a variable equal to whatever is in cell A1
this one is a toughy....
 
x = cells(1, 1).Value
Workbooks(x).Activate

Or

x = Range("A1").Value
Workbooks(x).Activate

In either of those two syntax you would need to be in the active worksheet,
otherwise you would have to specify the worksheet like:

x = Worksheets(2).Cells(1, 1).Value
Workbooks(x).Activate

Your active workbook would have to be in the same directory as the workbook
you call from Range("A1"), if you do not have the entire path in that cell.
 

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