Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count contents in a column


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Count contents in a column

This will count all of the populated cells in column A

MsgBox Application.WorksheetFunction.CountA(Columns("A"))
--
HTH...

Jim Thomlinson


"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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count contents in a column


Seems simple enough to me and I was looking at something more
complicated...

ThanKs!


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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill a column with the contents of another column based on a choic Sparky56 Excel Discussion (Misc queries) 1 March 31st 07 04:18 AM
how to copy contents of one column to another column in another worksheet yefei Excel Discussion (Misc queries) 3 February 25th 06 05:57 PM
move contents of column C based on criteria related to column A Debra Excel Discussion (Misc queries) 2 December 27th 05 10:25 PM
Count Intervals of Filtered TEXT values in Column and Return Count across a Row Sam via OfficeKB.com Excel Worksheet Functions 9 July 31st 05 03:37 AM
Count the contents in a cell Alan Reid Excel Worksheet Functions 3 November 19th 04 04:59 PM


All times are GMT +1. The time now is 06:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"