Thread: countif
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Brian C Brian C is offline
external usenet poster
 
Posts: 37
Default countif

I am counting the rows in a selected column using the following code which is
working fine. However, I would like to modify this to count the rows where
the value < 0.

Please help

Dim rng As Range, rng1 As Range
Set rng = Selection
If rng.Areas.Count 1 Then
MsgBox "non contiguous areas selected - exiting"
Exit Sub
End If
If rng.Columns.Count 1 Then
MsgBox "multiple columns selected = exiting"
Exit Sub
End If
Set rng1 = rng(rng.Count).Offset(1, 0)
rng1.Formula = "=Count(" & rng.Address(1, 1) & ")"