ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how do i set up opening a file from a cell in excel spreadsheet (https://www.excelbanter.com/excel-discussion-misc-queries/243242-how-do-i-set-up-opening-file-cell-excel-spreadsheet.html)

scott

how do i set up opening a file from a cell in excel spreadsheet
 
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

Jacob Skaria

how do i set up opening a file from a cell in excel spreadsheet
 
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
---------------
Jacob Skaria


"Scott" wrote:

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


Jacob Skaria

how do i set up opening a file from a cell in excel spreadshee
 
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()

--
If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"Scott" wrote:

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



All times are GMT +1. The time now is 02:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com