Discussion Locked

Open Worksheet via Variable in Excel vba

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I want to be able to store a list of infividual Excel workbooks in a column in a master workbook. I want to be able to open each of these workbooks in turn, via a macro, and extract data from them. Can I store the individual workbook name as a variable and pass it to the open.workbook command?? If so, what is the proper syntax, or where can I find it?

Thanx

1 reply

by dklippert

You don't need to open the Workbook to extract information.
This quick piece of code identifies the Workbook name in Cell A1 of the Master Workbook.
It then uses that name and a known data location to insert the data in the Master Workbook. You'llwant to doctor this, but the key is the & for concatenation.

Sub DataGrabber()

ListedFile = "[" & Range("A1") & "]"
ActiveCell = "=" & ListedFile & "Sheet1!R5C3"

End Sub

This discussion is closed to new replies.