Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 49948

Search through multiple excel files and get data

$
0
0
Hi All,

I'm currently using the following code to "pull" a range data from a closed workbook.

Code:

Private Sub CommandButton1_Click()
With Sheets("Sheet1").Range("H21:H38")
    .Formula = "='C:\Users\[Workbook1.xls]Sheet1'!M35"
    .Value = .Value
End With
End Sub

This works well if I know which workbook and sheet I will be getting the info from. What I would like to do is add a function that searches through a few workbooks looking for a worksheet name that matches a value in a cell in my original workbook.

ie. Workbook 1, cell A1 = "Jelly"

search through excel files for the workbook that contains the worksheet named "Jelly" and then copy a range from that worksheet back to workbook 1.

Does this make sense? Thanks for any help you can provide!

Viewing all articles
Browse latest Browse all 49948

Trending Articles