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

I have selected a column and called it "Mark" I need to determine the number
of rows in this column with values in them at runtime. The number of rows
used in this column will vary.

How do I determine the number of rows with values?

If I use Range("Mark").Rows.Count it appears to return a very large number.

thank you
mark



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Rows in a Range


This would get you the count all filled cells in the range
application.countA(Range("mark"))
This would get you the count all NUMERIC cells in the range
application.count(Range("mark"))

Notes:
VBA
Range("mark") is unqualified, thus works on the activeworkbook only.
VBA
application.countA is preferred notation for
application.worksheetfunction.countA
(you dont get intellisense, but you dont get runtime errors either)

NAME object
when you use names be aware of the differences in using "local" and
"global" names. If your sheet may be copied by users IMO it's better to
use "local" names only.

You'll define "local" names by adding the sheet's name and an exclamation
mark to them in the define name dialog. e.g. Sheet1!mark





--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam

John Smith wrote in message
:

I have selected a column and called it "Mark" I need to determine the
number of rows in this column with values in them at runtime. The
number of rows used in this column will vary.

How do I determine the number of rows with values?

If I use Range("Mark").Rows.Count it appears to return a very large
number.

thank you
mark





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Rows in a Range

thank you
mark

"keepITcool" wrote in message
...

This would get you the count all filled cells in the range
application.countA(Range("mark"))
This would get you the count all NUMERIC cells in the range
application.count(Range("mark"))

Notes:
VBA
Range("mark") is unqualified, thus works on the activeworkbook only.
VBA
application.countA is preferred notation for
application.worksheetfunction.countA
(you dont get intellisense, but you dont get runtime errors either)

NAME object
when you use names be aware of the differences in using "local" and
"global" names. If your sheet may be copied by users IMO it's better to
use "local" names only.

You'll define "local" names by adding the sheet's name and an exclamation
mark to them in the define name dialog. e.g. Sheet1!mark





--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam

John Smith wrote in message
:

I have selected a column and called it "Mark" I need to determine the
number of rows in this column with values in them at runtime. The
number of rows used in this column will vary.

How do I determine the number of rows with values?

If I use Range("Mark").Rows.Count it appears to return a very large
number.

thank you
mark







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Rows in a Range

See response to original question.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"John Smith" wrote in message
...
I have selected a column and called it "Mark" I need to determine the

number
of rows in this column with values in them at runtime. The number of rows
used in this column will vary.

How do I determine the number of rows with values?

If I use Range("Mark").Rows.Count it appears to return a very large

number.

thank you
mark





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
How can change range to select active rows instead of :=Range("S10 ldiaz Excel Discussion (Misc queries) 7 August 29th 08 03:52 PM
Not listing more than a range of rows Richard P Excel Worksheet Functions 2 September 18th 06 12:43 AM
formula to sort a range so that it matches the exact rows of a column that is outside that range? steveo Excel Discussion (Misc queries) 1 June 18th 06 02:05 AM
group rows in a range based on criteria from another range (vba) Andy Excel Programming 2 April 28th 04 03:26 AM
How to subtract some rows from a range Simon Lenn Excel Programming 3 March 5th 04 01:16 PM


All times are GMT +1. The time now is 09:41 AM.

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

About Us

"It's about Microsoft Excel"