A
andycharger
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
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