alexaronson
Active Member
- Joined
- Sep 30, 2005
- Messages
- 314
Hello and thanks for looking at my two part question.
I am consolidating several data sources into a single table for a tool that I am building.
As of right now, I have 36 vba vlookups to build my table. In many instances, I have to hit the same sheet and row to get the data I need to fill out my table. I want to see if there is a way for me to eliminate 32 of my vlookups.
Here is an example of my code.
As you can see, in this example I have two Vlookups going to the same table (yagWS), but only pulling one cell each.
Question 1) How can I use a vlookup to just the find the row that the data is on?
If I know the row (lets call it "y"), I can pull the second data set without the vlookup by using the following as well as other data points on that row.
Question 2) How could I find a row, then pull a range of data based upon that row from yagWS into tpmWS in a single transaction with out using range(blah, blah).Copy
Thanks for looking at my questions
I am consolidating several data sources into a single table for a tool that I am building.
As of right now, I have 36 vba vlookups to build my table. In many instances, I have to hit the same sheet and row to get the data I need to fill out my table. I want to see if there is a way for me to eliminate 32 of my vlookups.
Here is an example of my code.
Code:
'Avg Traited Points of Distribution
On Error Resume Next
x = WorksheetFunction.VLookup(tpmWS.Cells(i, j), yagWS.Range("A1:F" & LastRow5), 6, False)
If Err.Number = 0 Then tpmWS.Cells(i, j + 27) = x
'POS Store Count
On Error Resume Next
x = WorksheetFunction.VLookup(tpmWS.Cells(i, j), yagWS.Range("A1:G" & LastRow5), 7, False)
If Err.Number = 0 Then tpmWS.Cells(i, j + 28) = x
As you can see, in this example I have two Vlookups going to the same table (yagWS), but only pulling one cell each.
Question 1) How can I use a vlookup to just the find the row that the data is on?
If I know the row (lets call it "y"), I can pull the second data set without the vlookup by using the following as well as other data points on that row.
Code:
tpmWS.Cells(i,j+28) = yagWS.Cells(y,7)
tpmWS.Cells(i,j+29) = yagWS.Cells(y,8)
tpmWS.Cells(i,j+30) = yagWS.Cells(y,9)
Question 2) How could I find a row, then pull a range of data based upon that row from yagWS into tpmWS in a single transaction with out using range(blah, blah).Copy
Thanks for looking at my questions