VBA - Compare values in one range to another range

Ron512

Board Regular
Joined
Nov 17, 2002
Messages
98
I need some help getting started with a macro to compare values in one range to another range.

Range1 is the baseline so if Range2 has a value that is not in the Range1 it is highlighted, If Range2 does not have a value that is in Range1 that value is copied from Range1 to another column. The values do not line up with each other by row so each value in Range1 must be compared to each value in Range2. Both ranges are single columns and the values are strings.

Thanks

Ron
 
also what does "Nothing" actually mean in this line?

Code:
RngList.Add Rng.Value, Nothing

regards
thanks :)

Sukh
 
Upvote 0

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.
A dictionary stores {Key,Item} pairs. (We're not allowed to omit the Item.)

By not specifying the key, it is by default assigning its own key to the item being added.

In the code posted earlier, Nothing (the default state of an uninitialized object variable) is used as the Item. It could alternatively be a null string ("" or vbNullString) or 0, or anything else that doesn't take up a lot of space.
so... while it's not being givin an Item by name, it is being addressed.


(Does that help answer both questions?)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,244
Messages
6,170,976
Members
452,372
Latest member
Natalie18

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