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: 1
Default 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
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
Counting Loop - Please help Zachary Baker Excel Discussion (Misc queries) 1 October 9th 08 04:57 AM
Counting Match Pairs In Rows bmb2200 Excel Worksheet Functions 4 August 25th 05 03:35 AM
Counting files using Loop Ron[_13_] Excel Programming 0 October 28th 03 07:45 PM
Counting files using Loop Ron[_13_] Excel Programming 0 October 28th 03 07:45 PM
Counting files using Loop Ron[_13_] Excel Programming 0 October 28th 03 07:45 PM


All times are GMT +1. The time now is 10:28 PM.

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

About Us

"It's about Microsoft Excel"