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

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
 
J

Jacob Skaria

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
 
J

Jacob Skaria

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()>
 

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

Top