ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   count value in column and VBA (https://www.excelbanter.com/excel-programming/303344-count-value-column-vba.html)

RichardO[_14_]

count value in column and VBA
 
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

--
Message posted from http://www.ExcelForum.com


kkknie[_157_]

count value in column and VBA
 
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



--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 04:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com