Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Naming range where the no of rows indeterminate


Could somebody please explain how, within a macro, to define a rang
which applies to -n- rows of data.
Each time the spreadsheet is created the number of lines contained wil
change, the 1st blank line will be blank.

Many thank

--
Feedsma
-----------------------------------------------------------------------
Feedsman's Profile: http://www.excelforum.com/member.php...fo&userid=3437
View this thread: http://www.excelforum.com/showthread.php?threadid=54156

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Naming range where the no of rows indeterminate

By "the first blank line will be blank": do you mean that the first blank
line signifies the end of the range?

There are a few techniques you can use to find the next blank row down (or
blank column across) from any cell. First, there is the .End method:
LastNonBlankCell = Range("A1").End(xlDown)

Then, there is the .CurrentRegion property:
With Range("A1")
LastNonBlankRow = .CurrentRegion.Rows(.CurrentRegion.Rows.Count)
End With

Or, you can iterate downward:
Set ThisCell = Range("A1")
While ThisCell.Value<""
Set ThisCell = ThisCell.Offset(1,0)
Wend
LastCellDown = ThisCell
--
- K Dales


"Feedsman" wrote:


Could somebody please explain how, within a macro, to define a range
which applies to -n- rows of data.
Each time the spreadsheet is created the number of lines contained will
change, the 1st blank line will be blank.

Many thanks


--
Feedsman
------------------------------------------------------------------------
Feedsman's Profile: http://www.excelforum.com/member.php...o&userid=34377
View this thread: http://www.excelforum.com/showthread...hreadid=541561


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 to SUM for indeterminate number of rows? MrNobody Excel Worksheet Functions 5 February 20th 09 08:17 AM
Creating a subtotal for an indeterminate number of rows Kim1802 Excel Discussion (Misc queries) 0 November 24th 06 12:27 PM
indeterminate 0/0 integreat Excel Discussion (Misc queries) 6 July 31st 06 02:36 AM
Range naming columns and rows Dean[_8_] Excel Programming 1 April 6th 05 02:57 AM
VB Code Naming a Range (range changes each time) krazylain Excel Programming 4 May 15th 04 12:41 PM


All times are GMT +1. The time now is 07:04 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"