Hello,
I would like to use VLookup to match the name entered in a userform dialog box to a name in Sheet("CRM_Lib") Column A. Then return the data that is ~20 columns wide from Sheet("CRM_Lib") to Sheet("Header") Cell ("Y42").
For instance the userform asks for a part #. I enter it, then the data for the part (contained in Sheet "CRM_Lib") is placed is Sheet "Header" , Starting at cell "Y42".
Heres an example of what I'm trying
The top row is chemical elements
The next row is the % of a part #.
I currently use a userform to enter a part # in the same row 3 columns to the left and then pastes a vloolup formula across the cells, but I'd like vba to do it with code.
[TABLE="width: 1856"]
<tbody>[TR]
[TD="width: 64, bgcolor: transparent"]Al[/TD]
[TD="width: 64, bgcolor: transparent"]As[/TD]
[TD="width: 64, bgcolor: transparent"]B![/TD]
[TD="width: 64, bgcolor: transparent"]Be[/TD]
[TD="width: 64, bgcolor: transparent"]C[/TD]
[TD="width: 64, bgcolor: transparent"]Ca![/TD]
[TD="width: 64, bgcolor: transparent"]Co[/TD]
[TD="width: 64, bgcolor: transparent"]Cr[/TD]
[TD="width: 64, bgcolor: transparent"]Cu[/TD]
[TD="width: 64, bgcolor: transparent"]Fe[/TD]
[TD="width: 64, bgcolor: transparent"]La[/TD]
[TD="width: 64, bgcolor: transparent"]Mg![/TD]
[TD="width: 64, bgcolor: transparent"]Mn[/TD]
[TD="width: 64, bgcolor: transparent"]Mo[/TD]
[TD="width: 64, bgcolor: transparent"]N![/TD]
[TD="width: 64, bgcolor: transparent"]Nb[/TD]
[TD="width: 64, bgcolor: transparent"]Ni[/TD]
[TD="width: 64, bgcolor: transparent"]P[/TD]
[TD="width: 64, bgcolor: transparent"]Pb[/TD]
[TD="width: 64, bgcolor: transparent"]S[/TD]
[TD="width: 64, bgcolor: transparent"]Sb[/TD]
[TD="width: 64, bgcolor: transparent"]Si[/TD]
[TD="width: 64, bgcolor: transparent"]Sn[/TD]
[TD="width: 64, bgcolor: transparent"]Ta[/TD]
[TD="width: 64, bgcolor: transparent"]Ti[/TD]
[TD="width: 64, bgcolor: transparent"]V[/TD]
[TD="width: 64, bgcolor: transparent"]W[/TD]
[TD="width: 64, bgcolor: transparent"]Zn[/TD]
[TD="width: 64, bgcolor: transparent"]Zr[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"](<0.002)[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]1.06[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]0.047[/TD]
[TD="bgcolor: transparent"]16.87[/TD]
[TD="bgcolor: transparent"]0.09[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]1.15[/TD]
[TD="bgcolor: transparent"]0.5[/TD]
[TD="bgcolor: transparent"]406[/TD]
[TD="bgcolor: transparent"]0.005[/TD]
[TD="bgcolor: transparent"]0.35[/TD]
[TD="bgcolor: transparent"]0.022[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]0.007[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]0.47[/TD]
[TD="bgcolor: transparent"](0.004)[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]0.001[/TD]
[TD="bgcolor: transparent"]0.13[/TD]
[TD="bgcolor: transparent"]0.11[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[/TR]
</tbody>[/TABLE]
Currently I try
The userform puts the part # in "V42". But I only get the data from the second column. In this case (<0.002). (The part # is the column 1). How to get the whole row?
Thanks
Tom
I would like to use VLookup to match the name entered in a userform dialog box to a name in Sheet("CRM_Lib") Column A. Then return the data that is ~20 columns wide from Sheet("CRM_Lib") to Sheet("Header") Cell ("Y42").
For instance the userform asks for a part #. I enter it, then the data for the part (contained in Sheet "CRM_Lib") is placed is Sheet "Header" , Starting at cell "Y42".
Heres an example of what I'm trying
The top row is chemical elements
The next row is the % of a part #.
I currently use a userform to enter a part # in the same row 3 columns to the left and then pastes a vloolup formula across the cells, but I'd like vba to do it with code.
[TABLE="width: 1856"]
<tbody>[TR]
[TD="width: 64, bgcolor: transparent"]Al[/TD]
[TD="width: 64, bgcolor: transparent"]As[/TD]
[TD="width: 64, bgcolor: transparent"]B![/TD]
[TD="width: 64, bgcolor: transparent"]Be[/TD]
[TD="width: 64, bgcolor: transparent"]C[/TD]
[TD="width: 64, bgcolor: transparent"]Ca![/TD]
[TD="width: 64, bgcolor: transparent"]Co[/TD]
[TD="width: 64, bgcolor: transparent"]Cr[/TD]
[TD="width: 64, bgcolor: transparent"]Cu[/TD]
[TD="width: 64, bgcolor: transparent"]Fe[/TD]
[TD="width: 64, bgcolor: transparent"]La[/TD]
[TD="width: 64, bgcolor: transparent"]Mg![/TD]
[TD="width: 64, bgcolor: transparent"]Mn[/TD]
[TD="width: 64, bgcolor: transparent"]Mo[/TD]
[TD="width: 64, bgcolor: transparent"]N![/TD]
[TD="width: 64, bgcolor: transparent"]Nb[/TD]
[TD="width: 64, bgcolor: transparent"]Ni[/TD]
[TD="width: 64, bgcolor: transparent"]P[/TD]
[TD="width: 64, bgcolor: transparent"]Pb[/TD]
[TD="width: 64, bgcolor: transparent"]S[/TD]
[TD="width: 64, bgcolor: transparent"]Sb[/TD]
[TD="width: 64, bgcolor: transparent"]Si[/TD]
[TD="width: 64, bgcolor: transparent"]Sn[/TD]
[TD="width: 64, bgcolor: transparent"]Ta[/TD]
[TD="width: 64, bgcolor: transparent"]Ti[/TD]
[TD="width: 64, bgcolor: transparent"]V[/TD]
[TD="width: 64, bgcolor: transparent"]W[/TD]
[TD="width: 64, bgcolor: transparent"]Zn[/TD]
[TD="width: 64, bgcolor: transparent"]Zr[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"](<0.002)[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]1.06[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]0.047[/TD]
[TD="bgcolor: transparent"]16.87[/TD]
[TD="bgcolor: transparent"]0.09[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]1.15[/TD]
[TD="bgcolor: transparent"]0.5[/TD]
[TD="bgcolor: transparent"]406[/TD]
[TD="bgcolor: transparent"]0.005[/TD]
[TD="bgcolor: transparent"]0.35[/TD]
[TD="bgcolor: transparent"]0.022[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]0.007[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]0.47[/TD]
[TD="bgcolor: transparent"](0.004)[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]0.001[/TD]
[TD="bgcolor: transparent"]0.13[/TD]
[TD="bgcolor: transparent"]0.11[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[TD="bgcolor: transparent"]-1[/TD]
[/TR]
</tbody>[/TABLE]
Currently I try
Code:
Range("Y42") = Application.WorksheetFunction.VLookup _
(Range("V42").Value, Sheets("CRM_Lib").Range("A2:AD2001"), 2, False)
The userform puts the part # in "V42". But I only get the data from the second column. In this case (<0.002). (The part # is the column 1). How to get the whole row?
Thanks
Tom