Check the conditions in "Q:Q"
see if this does what you want:
Sub CheckRange()
Dim Cell As Range
For Each Cell In ActiveSheet.Range("Q:Q")
If Cell.Value = _
dte And Cell.Offset(0, -6).Value = "XXX" Then
x = x + 1
ElseIf Cell.Value = _
dte And Cell.Offset(0, -6).Value = "YYY" Then
y = y + 1
ElseIf Cell.Value = _
dte And Cell.Offset(0, -6).Value = "ZZZ" Then
z = z + 1
ElseIf Cell.Value = _
dte And Cell.Offset(0, -6).Value = "XYZ" Then
i = i + 1
End If
Next Cell
End Sub
--
jb
"SR" wrote:
Hi,
I need a loop which will check the below conditions in all the cell (even if
the cells are blank") in column Q ("Q:Q")
If ActiveCell.Value = dte And ActiveCell.Offset(0, -6).Value = "XXX" Then
x = x + 1
ElseIf ActiveCell.Value = dte And ActiveCell.Offset(0,
-6).Value = "YYY" Then
y = y + 1
ElseIf ActiveCell.Value = dte And ActiveCell.Offset(0,
-6).Value = "ZZZ" Then
z = z + 1
ElseIf ActiveCell.Value = dte And ActiveCell.Offset(0,
-6).Value = "XYZ" Then
i = i + 1
else
ActiveCell.Offset(1, 0).Select
Thanks in advance.
SR
|