Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
counting the rows that match in my loop
Hi guys,
Long time no post! Anyway, I got a little poser for you.... My code is taking forever to run. I have a looping statement that ha about 6 or 7 nested if statements. Basically, It says the following [vb] For rowdates2 = Range("A1").End(xlDown).Row To 2 Step -1 If Cells(rowdates2, "A") = strBranch Then If Cells(rowdates2, "B") = strRef Then If Cells(rowdates2, "E") = strPCode Then If Cells(rowdates2, "I").Value = strRegNo Then If Cells(rowdates2, "J").Value = strTranDate Then If Cells(rowdates2, "K").Value = strTranType Then strCount = strCount + 1 Else End If Else End If Else End If Else 'do nothing End If Else 'do nothing End If Else 'do nothing End If Next [/vb] If it gets a match, it increases the counter by 1. (strCount) What I need it to do instead is if the counter is bigger than 0, d something. However, I do remember something about FIND in VBA. How can I get the number of matches (count) back by using the FIN statement? It would be quicker than using the loop. Any ideas let me kno -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Counting Loop - Please help | Excel Discussion (Misc queries) | |||
Counting Match Pairs In Rows | Excel Worksheet Functions | |||
Counting files using Loop | Excel Programming | |||
Counting files using Loop | Excel Programming | |||
Counting files using Loop | Excel Programming |