Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default 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
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
when a "check box" is checked, a "result" to be shown in another c Lisa Ann Kashner Excel Discussion (Misc queries) 2 November 6th 07 01:32 AM
Check if cells contain the word "Thailand", return "TRUE" ali Excel Worksheet Functions 7 September 14th 07 09:53 AM
How to check if one of the conditions returns "true"? Isito Excel Programming 4 September 6th 06 12:25 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
create links to check boxes marked "good" fair"and "bad" pjb Excel Worksheet Functions 3 April 20th 06 02:17 AM


All times are GMT +1. The time now is 08:08 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"