Using a Lookup table in VBA

saschmeling

New Member
Joined
Jun 27, 2012
Messages
39
Hi,

I need to pull data from one workbook into another based on a lookup table.

one workbook contains the lookup information. This is a projections workbook.- I need to pull data over to another workbook based on the report that is run. The report is created using VBA, so need to lookup the data in Column A of the Report Book and use the information from the projections book accordingly.

Any suggestions.

Thanks,
Scott
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
to use vlookup in VBA, you need to use:
Application.WorksheetFunction.CountIf

The structure is the same as in Excel. Vlookup(Lookup value,table,column,true/false)

Hope that helps with your development.
 
Upvote 0
to use vlookup in VBA, you need to use:
Application.WorksheetFunction.CountIf

The structure is the same as in Excel. Vlookup(Lookup value,table,column,true/false)

Hope that helps with your development.

Know this is going to make me sound lost but kind of am on this.

Tried this Code- and it did not work;

Application.WorksheetFunction.CountIf(RC[-6],'[5100 Projections.xlsm]Database'!R1C1:R728C7,6)

Any suggestions?

Thanks,
 
Upvote 0
have you tried using the countif function in excel, as in typing the formula out in a cell, and seeing if it returns a value?
Click on the fx in the formula bar if you want to play with some of the values.
I'm guessing it's the 6 at the end, but I could be wrong. Try changing that tot a false, I believe a 1 or 0 will also work.

Hope that helps.
 
Upvote 0
I think I may have it. When I gave you the first function, I put countif instead of vlookup.

Try:

Application.WorksheetFunction.VLookUp(RC[-6],'[5100 Projections.xlsm]Database'!R1C1:R728C7,6)
 
Upvote 0

Forum statistics

Threads
1,214,659
Messages
6,120,786
Members
448,993
Latest member
Seri

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