Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
when a "check box" is checked, a "result" to be shown in another c | Excel Discussion (Misc queries) | |||
Check if cells contain the word "Thailand", return "TRUE" | Excel Worksheet Functions | |||
How to check if one of the conditions returns "true"? | Excel Programming | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
create links to check boxes marked "good" fair"and "bad" | Excel Worksheet Functions |