Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello
I have this macro which works the way I want but does not report on it's findings in the way I need it to. My rows containing valued in cells A B C and D should match three times. If they do not match three times then that means I am missing transactions. This macro only gives me a message box and tells me how many times the rows appear.....I need the macro to highlight or enter a value in column F as to how many times it does appear so I can then filter out the transactions rather than right the row numbers does...... Someone please help.....I would be ever so grateful. I tried to do this myself but not working at all. Thanks, Andrea 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to highlight rows and... | Excel Programming | |||
Number in cell appears to be 10000 times too small | Excel Discussion (Misc queries) | |||
Macro Revision needed | Excel Programming | |||
enter a time into a cell, have the cell show two times the entry | Excel Worksheet Functions | |||
Very small macro/VBA stuff, deleting rows. | Excel Programming |