View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default creating a value for a file name

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.

"BEAST" wrote:

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....