ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Counting the number of nonempty cells (https://www.excelbanter.com/excel-programming/317775-counting-number-nonempty-cells.html)

Steve[_72_]

Counting the number of nonempty cells
 
I want to count the number of nonempty cells in column A. However, I do not
want to start with cell A1. I want to begin counting in cell A4. Then I
would llike to assign this value to a variable. Any help would be greatly
appreciated.

Thanks
sc



Norman Jones

Counting the number of nonempty cells
 
Hi SC,

Try:

Sub Tester()
Dim rng As Range
Dim iCtr As Long

Set rng = Range("A4:A" & Rows.Count)
i = Application.CountA(rng)
'Return count of populated cells
MsgBox iCtr

End Sub

---
Regards,
Norman



"Steve" wrote in message
...
I want to count the number of nonempty cells in column A. However, I do
not want to start with cell A1. I want to begin counting in cell A4. Then
I would llike to assign this value to a variable. Any help would be
greatly appreciated.

Thanks
sc





All times are GMT +1. The time now is 10:34 AM.

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