LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Small Macro Revision - to highlight rows and enter how many times they appear in a cell rather than a msg box.

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to highlight rows and... Dave Birley Excel Programming 1 May 1st 07 01:38 PM
Number in cell appears to be 10000 times too small morris Excel Discussion (Misc queries) 1 May 6th 06 11:45 PM
Macro Revision needed HJ Excel Programming 5 May 27th 05 09:57 PM
enter a time into a cell, have the cell show two times the entry johnp Excel Worksheet Functions 3 May 2nd 05 12:08 AM
Very small macro/VBA stuff, deleting rows. Sintel Excel Programming 6 September 6th 04 05:09 PM


All times are GMT +1. The time now is 05:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"