View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default How to increase counter based on values in 2 different cells

Dim ctr As Long
Dim oRow As Range

For Each oRow In ActiveSheet.UsedRange.Rows
If Cells(oRow.Row, "X").Value = 1 And _
Cells(oRow.Row, "Y").Value = 50 Then
ctr = ctr + 1
End If
Next oRow


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"txlonghorn1989" wrote in message
oups.com...
I want to check 2 cells (2 different columns) for a worksheet.

Easy to do programmatically but not familiar with spreadsheet
functions. Here's what I want to do in psuedo code...

For every row (with data) in a worksheet
If column X cell = 1 AND column Y cell = 50
ctr = ctr + 1

Any help would be appreciated.

Mike