Macro to look for three rows of everything

  • Thread starter Thread starter amorrison2006
  • Start date Start date
A

amorrison2006

Hi there,

I need a macro to look down say columns A B and C and find three rows
which match in amount, date, and order number.

I would prefferably like to have it look for a specific entry in that
column D must be say X and Columns A B and C match.

And another row that says Y andcolumns A B and C match.

And another one that says Z and columns A B and C match.

The thing is my system needs to have three rows which are the same to
be input in different systems.

I need to check to see if any data from Z above is missing from X and
Y.and then reinput them manually to make sure all three of the
accounts are matching,

I hope this makes sense to someone,

Thanks

Andrea
 
this code will find all the rows where columns A B C match and display the
number of times each combination is found. You will have to modify the code
to meet all your requirments. try the code and let me know how it needs to
be modified.


Sub findtriples()

Lastrow = Cells(Rows.Count, "A").End(xlUp).Row

For RowCount = 1 To Lastrow

'Make sure data didn't appear earlier
Found = False
For OldRowCount = 1 To (RowCount - 1)
If Cells(RowCount, "A") = Cells(OldRowCount, "A") And _
Cells(RowCount, "B") = Cells(OldRowCount, "B") And _
Cells(RowCount, "C") = Cells(OldRowCount, "C") Then

Found = True
Exit For
End If
Next OldRowCount

If Found = False Then
'Count number of times combination is found
TimesFound = 1
RowsFound = CStr(RowCount)
For NewRowCount = (RowCount + 1) To Lastrow

If Cells(RowCount, "A") = Cells(NewRowCount, "A") And _
Cells(RowCount, "B") = Cells(NewRowCount, "B") And _
Cells(RowCount, "C") = Cells(NewRowCount, "C") Then

TimesFound = TimesFound + 1
RowsFound = RowsFound & "," & CStr(NewRowCount)
End If
Next NewRowCount

ABCData = CStr(Cells(RowCount, "A")) & ", " & _
CStr(Cells(RowCount, "B")) & ", " & _
CStr(Cells(RowCount, "C"))
MsgBox ("Row " & CStr(RowCount) & _
" data was found " & CStr(TimesFound) & _
" time(s)" & Chr(10) & _
"Data = " & ABCData & Chr(10) & _
"Row(s) = " & RowsFound)
End If

Next RowCount

End Sub
 
Thanks Joel

Will give a try tomorrow and let you now,

Many thanks

Andrea
 
Hi Joel,

This does what I need,

Rather than a message box is there a way they can be sorted in order
of the number of time they appear so I can easily identify the items
which don't appear three times or fours time? Can the amount of times
I expect to see it be variable?

Thanks

Andrea
 
Can someone help with this?

I just want Josh's macro to highlight the rows that are found less
than three time in red and also place in cell in column G how many
time it has appeared,

Hope this makes sense....

THanks alot

Andrea
 
Hi Joel,

In this macro you created there was one thing ommitted which I have
just found out today from using your macro.....I don't know how easy
it is to change.....

There must be one entry from each of the banking systems I use, for
example a HSBC, CITIBANK, BANKOFAMERICA.....these are located in
column A all the data should match.....so if the transaction has gone
through HSBC I want to make sure it's also gone through the other two
banks. And also anything that has gone through the other two banks
that hasnt gone through the HSBC bank account.

All I want to make sure is that all bank accounts are the same......

I hope you can help change your macro and sorry....i didnt think this
would be an issue but I only noticed today that HSBC had three
transactions going through and this was omitted from the other two
bank accounts but I didnt check because it had appeated 3
times........

Thanks so much,

Andrea
 

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

Back
Top