Copying date if 'date' matches with the reference

S

Sajjad Qureshi

I have data in different tables. When I collate the two, the two sets
of data doesn't match line by line using the date columns as a
reference. How can I remove non matching rows from the 2nd data set?

Here is how the table looks like.

2/13/1979 2/13/1979 22.894 1.01044
2/14/1979 2/14/1979 22.894 1.01044
2/15/1979 2/15/1979 22.894 1.01044
2/16/1979 2/16/1979 23.064 1.01044
2/20/1979 2/19/1979 23.064 1.01009 'need to remove this
2/21/1979 2/20/1979 23.064 1.01009
2/22/1979 2/21/1979 23.064 1.01009
2/23/1979 2/22/1979 23.064 1.01009
2/26/1979 2/23/1979 23.221 1.01009
2/27/1979 2/26/1979 23.221 1.01033
....................
Thanks for your help
 
Joined
Sep 20, 2009
Messages
47
Reaction score
2
I am not clear. not only row no. 6 does not have same values in A and B also rows 6 to thelast row do not have same values in A and B . this macro keep onloy rows 1 to 5

AS YOU ARE MESSING UP WITH DATA COPY THE FULL DATA IN SHEET 2 BEFORE DOING ANYTHING.

try this macro tes

Code:
Sub test()
Dim j As Integer, k As Integer
worksheets("sheet1").activate
j = Cells(Rows.Count, "A").End(xlUp).Row
For k = j To 1 Step -1
If Cells(k, "a") <> Cells(k, "b") Then
Cells(k, "A").EntireRow.Delete
End If
Next k

End Sub


if there is problem clear the data in sheet 1 and copy form sheet 2
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top