View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Count contents in a column

msgbox application.counta(worksheets("sheet1").range("d:d "))

is one way.

JWM6 wrote:

I need to return the number of cells that contain values in a column.

I've played with Selection.EntireColumn Select &
Selection.Columns.Count but these just return the number of columns I
have selected versus the number of values in those columns.

I'm looking for the VBA code that does the spreadsheet formula
"=counta(D:D)", which returns the number of values in the column "D".
I don't need the values themselves, just an indication if there are any
values in the first place.

Thanks,

--
JWM6
------------------------------------------------------------------------
JWM6's Profile: http://www.excelforum.com/member.php...o&userid=33413
View this thread: http://www.excelforum.com/showthread...hreadid=534361


--

Dave Peterson