Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to SUM for indeterminate number of rows? | Excel Worksheet Functions | |||
Creating a subtotal for an indeterminate number of rows | Excel Discussion (Misc queries) | |||
indeterminate 0/0 | Excel Discussion (Misc queries) | |||
Range naming columns and rows | Excel Programming | |||
VB Code Naming a Range (range changes each time) | Excel Programming |