x = 0
For Each cell in Sheets("01").Range("A:A").Cells
If cell.Value = "aaa" And cell.Offset(0, 1).Value = "bbb" Then
x = x+1
End If
Next cell
MsgBox x
Is there a shorter way, pls ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do this with a formula, like this
(Excel 2007 or later)
(Excel 2003 or earlier)
Or, if you have to do it in VBA, use
EvaluateEDIT based on your comment
If
rDatandrSecareRange‘s, andctis the sheetCodeNamedo it like thisIf
ctis the sheetName, use thisIf
rDatandrSecare strings, use thisAnother option (for
rDat,rSecas ranges)