how do i set up opening a file from a cell in excel spreadsheet

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

I am trying to set up a worksheet, I want to be able to put in a file name in
a cell and then have a macro look at that and open the file
 
Type in the full path and file name in cell A1 and run the macro. eg:
C:\test.xls

Sub Macro()
Workbooks.Open CStr(Range("a1"))
End Sub

If this post helps click Yes
 
If it is not the active worksheet; you can mention the sheet name as well as
below

Sub Macro()
Workbooks.Open Cstr(Activeworkbook.Sheets("Sheet3").Range("a1"))
End Sub

If you are new to macros..

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run <selected macro()>
 
Back
Top