ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Select Data Range (https://www.excelbanter.com/excel-discussion-misc-queries/238851-select-data-range.html)

alexrs2k

Select Data Range
 
Wise forum, I have a range of data I want to select to perform some rutinary
tasks. I want to select only the data and not the whole sheet. I tried using
this:

Range("A2", "I" & Rows.Count).End(xlDown).Select

but it doesn't work. Can anybody tell me what is wrong? Thank you.

Bob Phillips[_3_]

Select Data Range
 
Assuming Excel 2003, Rows.Count will hold 65536, which means that
Range("A2", "I" & Rows.Count) will pick a full range, so End(xlDown) is just
not necessary.

--
__________________________________
HTH

Bob

"alexrs2k" wrote in message
...
Wise forum, I have a range of data I want to select to perform some
rutinary
tasks. I want to select only the data and not the whole sheet. I tried
using
this:

Range("A2", "I" & Rows.Count).End(xlDown).Select

but it doesn't work. Can anybody tell me what is wrong? Thank you.




Gord Dibben

Select Data Range
 
Sub test()
Dim Lrow As Long
With ActiveSheet
Lrow = .Range("A" & Rows.Count).End(xlUp).Row
.Range("A2:I" & Lrow).Select
End With
End Sub

Note: you don't generally have to select something to operate on it.


Gord Dibben MS Excel MVP

On Tue, 4 Aug 2009 08:06:01 -0700, alexrs2k
wrote:

Wise forum, I have a range of data I want to select to perform some rutinary
tasks. I want to select only the data and not the whole sheet. I tried using
this:

Range("A2", "I" & Rows.Count).End(xlDown).Select

but it doesn't work. Can anybody tell me what is wrong? Thank you.



alexrs2k

Select Data Range
 
That's the problem with that, I don't want all the rows just the ones that
have Data. How can I select only the data and leave the rest unselected?

"Bob Phillips" wrote:

Assuming Excel 2003, Rows.Count will hold 65536, which means that
Range("A2", "I" & Rows.Count) will pick a full range, so End(xlDown) is just
not necessary.

--
__________________________________
HTH

Bob

"alexrs2k" wrote in message
...
Wise forum, I have a range of data I want to select to perform some
rutinary
tasks. I want to select only the data and not the whole sheet. I tried
using
this:

Range("A2", "I" & Rows.Count).End(xlDown).Select

but it doesn't work. Can anybody tell me what is wrong? Thank you.





alexrs2k

Select Data Range
 
Gord, you are the man. It worked out like "tube" as a friend of mine used to
say. THANK YOU!!!
--
Alex
*Remember to click "yes" if this post helped you. Thank you!



"Gord Dibben" wrote:

Sub test()
Dim Lrow As Long
With ActiveSheet
Lrow = .Range("A" & Rows.Count).End(xlUp).Row
.Range("A2:I" & Lrow).Select
End With
End Sub

Note: you don't generally have to select something to operate on it.


Gord Dibben MS Excel MVP

On Tue, 4 Aug 2009 08:06:01 -0700, alexrs2k
wrote:

Wise forum, I have a range of data I want to select to perform some rutinary
tasks. I want to select only the data and not the whole sheet. I tried using
this:

Range("A2", "I" & Rows.Count).End(xlDown).Select

but it doesn't work. Can anybody tell me what is wrong? Thank you.




Gord Dibben

Select Data Range
 
Thanks for the feedback.

Gord

On Tue, 4 Aug 2009 09:02:01 -0700, alexrs2k
wrote:

Gord, you are the man. It worked out like "tube" as a friend of mine used to
say. THANK YOU!!!




All times are GMT +1. The time now is 07:11 PM.

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