View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SunTzuComm SunTzuComm is offline
external usenet poster
 
Posts: 30
Default 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