ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select a range within a range (https://www.excelbanter.com/excel-programming/374530-select-range-within-range.html)

nxqviet

Select a range within a range
 
Hi all,

I think I'm making this harder than it really is, but I can't see any
other way to do it. I have a range, where I want to select a number of
rows within it. This range is very large, and I just need to select an
"x" number of rows. here is the code i have.

Dim x As Integer
x = ((intPackNCount * 2) + intPackDCount)

Dim Ra1 As Range
Set Ra1 = Range("Select")

Application.Goto Ra1
Range("(Ra1.Rows(1)):(Ra1.Rows(x))").Select

Is there an easier way to do this? Please help.

Thanks

V


Tom Ogilvy

Select a range within a range
 
Dim x As Integer
x = ((intPackNCount * 2) + intPackDCount)

Dim Ra1 As Range
Set Ra1 = Range("Select")
Ra1.Resize(x).Select

just to illustrate from the immediate window:

?Range("A1:Z26").Resize(5).Address
$A$1:$Z$5



--
Regards,
Tom Ogilvy

"nxqviet" wrote in message
oups.com...
Hi all,

I think I'm making this harder than it really is, but I can't see any
other way to do it. I have a range, where I want to select a number of
rows within it. This range is very large, and I just need to select an
"x" number of rows. here is the code i have.

Dim x As Integer
x = ((intPackNCount * 2) + intPackDCount)

Dim Ra1 As Range
Set Ra1 = Range("Select")

Application.Goto Ra1
Range("(Ra1.Rows(1)):(Ra1.Rows(x))").Select

Is there an easier way to do this? Please help.

Thanks

V





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

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