ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Defining Range (https://www.excelbanter.com/excel-programming/277032-defining-range.html)

MAB[_5_]

Defining Range
 
How do I define a range from sheet1!a2 to the last nonempty cell in the A
column
The name of the range should be equal to sheet!a1 ( the top most cell )

similarly for other columns b, c, d, e






Tom Ogilvy

Defining Range
 
With Worksheets("Sheet1")
set rng = .Range(.Range("A2"),.Cells(rows.count,1).End(xlup) )
End With


similarly for b, c, d, e

--
Regards,
Tom Ogilvy

"MAB" wrote in message
...
How do I define a range from sheet1!a2 to the last nonempty cell in the A
column
The name of the range should be equal to sheet!a1 ( the top most cell )

similarly for other columns b, c, d, e








Arvi Laanemets[_2_]

Defining Range
 
Hi

Without VBA

=OFFSET(Sheet1!$A$2,,,COUNTIF(Sheet1!$A:$A)-1)
but you have to enter the name manually. And you mustn't have gaps in column
A.


Arvi Laanemets


"MAB" wrote in message
...
How do I define a range from sheet1!a2 to the last nonempty cell in the A
column
The name of the range should be equal to sheet!a1 ( the top most cell )

similarly for other columns b, c, d, e









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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com