VBA Code to compare data between 2 sheets and copy differences

shafiq2

New Member
Joined
Jun 19, 2014
Messages
42
Hi,

I have a master list of Date in Column B and Ex.Rate in column A "Sheet1", and another sheet called "Sheet2" this sheet gets updated with new Date and ex.range, I want a VBA code to compare this two list and add the differences in new row from sheet2 to sheet1 same range.

Kind Regards,
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
shafiq2,

1. What version of Excel and Windows are you using?

2. Are you using a PC or a Mac?

Can you post a screenshot of the actual raw data worksheet?


So that we can get it right on the first try, can we see what your worksheets look like?


And, can you post a screenshot of the worksheet results (manually formatted by you) that you are looking for?

To post your data, you can download and install one of the following two programs:
1. MrExcel HTMLMaker20101230
https://onedrive.live.com/?cid=8cffdec0ce27e813&sc=documents&id=8CFFDEC0CE27E813!189

Installation instructions here:
http://www.mrexcel.com/forum/board-announcements/515787-forum-posting-guidelines.html#post2545970

2. Excel Jeanie
Download


If you are not able to give us screenshots:
You can upload your workbook to Box Net,
sensitive data changed
mark the workbook for sharing
and provide us with a link to your workbook.
 
Upvote 0
I managed to get the following VBA code, it works fine and add the new date in the masterlist and avoid duplicates however I want also if value from column B is added to masterlist then the value from column A of sheet1 should also be added to column A in the same row of sheet "masterlist"

Sub COMBINE()
Dim rLoop As Range

For Each rLoop In Worksheets("sheet1").UsedRange.Columns(2).Cells
With Worksheets("masterlist")
If Not WorksheetFunction.CountIf(.UsedRange.Columns(2), rLoop.Value) > 0 Then
.Range("B" & Rows.Count).End(xlUp).Offset(1).Value = rLoop.Value



End If
End With
Next rLoop

End Sub
 
Upvote 0
shafiq2,

The workbook in your reply #3 is no longer available.

And, the workbook in your reply #4 is asking for a UserID, and, Password?


You can upload your workbook to Box Net,

sensitive data changed

mark the workbook for sharing

and provide us with a link to your workbook.
 
Last edited:
Upvote 0
shafiq2,

I have found the solution

1. If you found a macro solution, can we see the macro?

When posting VBA code, please use Code Tags - like this:

[code=rich]

'Paste your code here.

[/code]


1a. If so, can we have a link to your other post/thread?


2. Did you find the solution on MrExcel, or, at another site?

2a. If so, can we have a link to your other post/thread?
 
Last edited:
Upvote 0
Hi,

I found the solution myself.

I simply copied the new data into the master list and then used removed duplicates option in excel.

I have created a macro for this and this exercise is done through MACRO now.


Best Regards,
 
Upvote 0
shafiq2,

Thanks for the feedback.

I have created a macro for this

It would have been interesting to see your macro code.

Glad you were able to solve your own request.
 
Upvote 0

Forum statistics

Threads
1,224,801
Messages
6,181,047
Members
453,014
Latest member
Chris258

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