ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Create Range from Range (https://www.excelbanter.com/excel-discussion-misc-queries/263560-create-range-range.html)

dksaluki

Create Range from Range
 
Excel VBA:
Let's say I have a range object set to be from B2:F6, and i need to
make another range object to be the last row of my original range.
(New range to be B6:F6) How would i go about doing this? I tried
the .Resize option, but that only works from the top left cell of a
range.

DK

Dave Peterson[_2_]

Create Range from Range
 
Another method:

Dim Rng1 as range
Dim Rng2 as range

set rng1 = activesheet.range("b2:F6")
set rng2 = rng1.rows(rng1.rows.count)

or
with rng1
set rng2 = .rows(.rows.count)
end with



dksaluki wrote:

Excel VBA:
Let's say I have a range object set to be from B2:F6, and i need to
make another range object to be the last row of my original range.
(New range to be B6:F6) How would i go about doing this? I tried
the .Resize option, but that only works from the top left cell of a
range.

DK


--

Dave Peterson

dksaluki

Create Range from Range
 
man, it seems so easy when you see it! thank guys!

DK



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

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