Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default How to get actual rows number in Excel using VBA?

Hi all,
Currently in my sheet1, the actual rows number is 20, that is,
only the first 20 rows have content in it.
But I use ActiveSheet.UsedRange.Rows.Count, and it gets 26, and
sometimes more.
Why?
How can I get the exactly 20?
Thanks.

michael

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default How to get actual rows number in Excel using VBA?

..UsedRange means the cells have been used, but does not mean that they are
necessarily still in use.

..CurrentRegion is good for finding the current range, as long as it is a
continuous rectangular range. So Range("A1").CurrentRegion.Rows.Count tells
how many rows are included in the region starting at A1.
--
- K Dales


" wrote:

Hi all,
Currently in my sheet1, the actual rows number is 20, that is,
only the first 20 rows have content in it.
But I use ActiveSheet.UsedRange.Rows.Count, and it gets 26, and
sometimes more.
Why?
How can I get the exactly 20?
Thanks.

michael


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default How to get actual rows number in Excel using VBA?

Got it!
Thank you very much, Dales!
It really helps!

michael

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default How to get actual rows number in Excel using VBA?

Got it!
Thank you very much, Dales!
It really helps!

michael

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default How to get actual rows number in Excel using VBA?

In a situation where that doesn't work, delete the extra rows (and/or
columns) using Edit/Delete, than Save. Sometimes I have to do a Save As.
You can use Ctrl+End to see what Excel sees as the end of the used range.

" wrote:

Got it!
Thank you very much, Dales!
It really helps!

michael


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
actual row number climate Excel Worksheet Functions 3 March 17th 10 07:59 AM
I'm getting ##### in summation instead of the actual number allthreads Excel Discussion (Misc queries) 1 February 1st 09 03:28 PM
Currency format for Excel 2007 not displaying actual number gaelic_vixen Excel Discussion (Misc queries) 1 December 13th 07 02:17 PM
Actual value a non-zero number but display is Zero Hari Excel Discussion (Misc queries) 5 September 7th 05 03:00 PM
How do i Use actual number displayed? BrandenKilgore Excel Worksheet Functions 2 August 10th 05 09:29 PM


All times are GMT +1. The time now is 08:47 PM.

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"