count value in column and VBA

R

RichardO

Hi all:

I hope you can help with the following:

How do I write a macro that would count the number of cells in column
(column 19) that has a "NO"
then I want excel to go to the last row and insert "Total count" i
column R and the # of cells with a "NO" in column S,
Is it possible to do this with a macro?

thanks for helping

Richard
 
K

kkknie

This should do it.

Sub test()

Dim i As Long

i = Range("S65536").End(xlUp).Row
Range("R" & i + 1).Value = "Total count"
Range("S" & i + 1).Value
Application.WorksheetFunction.CountIf(Range("S1:S" & i), "=No")

End Sub
 
Top