ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Counting cells with data in them (https://www.excelbanter.com/excel-programming/310367-re-counting-cells-data-them.html)

SunTzuComm

Counting cells with data in them
 
Try this:

Sub count_filled()
Dim sectornum As Long
Dim rngX As Range
Dim lngX As Long

Range("D1", Range("D65536").End(xlUp)).Select
sectornum = Selection.Count
lngX = Application.WorksheetFunction.CountBlank(Selection )
MsgBox CStr(sectornum - lngX)
End Sub

Regards,
Wes


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

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