calling a workbook from a cell reference

Gregor

New Member
Joined
Aug 20, 2002
Messages
12
Hi,
At the moment i have an inputbox which passes a value to a cell. This value is the pathname for a workbook. When i try to refer to either the cell or the dim name to open the workbook i am unsuccessful.

Does anyone know what to do?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
i'd rather it went directly from the inputbox but I'm not sure how to approach either!

Sub input()
Dim path$
path = InputBox("Please input path in the format 'C:blah*.xls'", Title:="Path Entry")
Worksheets(1).Range("a12").Value = path
Call getSheet
End Sub

sub getSheet()

Workbooks.Open "??what goes in here??"

Workbooks("??what goes in here").Sheets(1).Copy _
after:=Workbooks("totals.xls").Sheets(5)

end sub
 
Upvote 0

Forum statistics

Threads
1,203,538
Messages
6,055,992
Members
444,839
Latest member
laurajames

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