Using a Worksheet name from a Cell

vectorges

New Member
Joined
Mar 11, 2002
Messages
4
I need to open a succession of workbooks. I would like to store the workbook names in a column, use the data value in the Workbooks.Open Filename: command. How do I convert the value of a cell (i.e. A19) to use it in the open command??
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You could use something like this:

Sub openit()

fname = WorksheetFunction.Substitute(Range("a19").Value, ".xls", "")
Workbooks.Open Filename:= _
"c:temp" & fname & ".xls"
End Sub


Just need to get the file path right...You could put this in the cell as well and get rid of "c:temp" &

Double quotes in this post should really be single quotes. Hope this helps. Cheers,

Nate
This message was edited by NateO on 2002-03-12 10:30
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top