Comparing Two data columns in two workbooks and filling a third column using VBA

saschmeling

New Member
Joined
Jun 27, 2012
Messages
39
Ok- so have another tough one.

I have two workbooks, one is called Projections, one is report. Using VBA, I want to compare column A in Report with Column A in Projection. If they are the same then I want Column C from Projection to fill in Column G in Report. These are two different workbooks and must remain so.

Here is as far as I can get.

Dim RRange as Range
Dim PRange as Range
Dim FRange as Range
Dim ORange as Range

Set RRange = Workbook- worksheet Report A:A
Set PRange = Workbook- Worksheet Project A:A
Set FRange = Workbook - Worksheet Project C:C
Set ORange = Workbook - Worksheet Report G:G

"I know that is not proper coding for the Set- is not what I wrote. What I am trying to do is keep it fairly generic as I will have to use this multiple times for multiple code sets.

So- the Question is- How do I write.

If a cell in PRange = RRange then output Frange into ORange.

The data set size is variable based on other code variables.

Any and all help would be great.

Thanks,
Scott
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,215,517
Messages
6,125,290
Members
449,218
Latest member
Excel Master

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