VBA cell content from another workbook

ThomasOES

Board Regular
Joined
Aug 29, 2017
Messages
174
I want to import the calcium value of sample NIST 1254 from a database in workbook "GDSCRM", Sheet1; to workbook "report" range "cert".
The workbook "report" needs the macro.
The database in workbook "GDSCRM" has thousands of entries. All the names are in column A. The top row of the sheet has the list of elements (Ex. C, S, Mg, Ca) beginning in column B.
So I would want to search column A for NIST 1254, then the row with the NIST 1254 for the value in the column labeled Ca.

Thanks
Tom
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
I was able to use the recorder and pieced together this code
Range "MonVal" is the Calcium content of sample NIST 1254
"MonVal" is a named cell
in a workbook titled "E826 Study".
The database is in the workbook GDSCRM.xlsx
Sheet1
The entire database is in the range A1:AD2000
"MonName" is a named cell in a workbook titled "E826 Study". In this instance the sample NIST 1254 is entered into the cell named "MonName"
The list of sample names is in column A
in the workbook GDSCRM.xlsx
"El" is a named cell
in a workbook titled "E826 Study"
. In this instance the symbol for calcium "Ca" is entered into the cell named "El"
The list of elements is in row 1
in the workbook GDSCRM.xlsx


Code:
Range("MonVal") = _
        "=INDEX([GDSCRM.xlsx]Sheet1!$A$1:$AD$2000,MATCH(MonName,[GDSCRM.xlsx]Sheet1!$A$1:$A$2000,0),MATCH(El,[GDSCRM.xlsx]Sheet1!$A$1:$BZ$1,1))"
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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