ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Expand a range by rows and columns (https://www.excelbanter.com/excel-programming/430869-expand-range-rows-columns.html)

Emma Aumack

Expand a range by rows and columns
 

Hi All,

I need to know how to expand a range by 2 rows. Here is what I have:

FinalRow = Range("A1").End(xlDown).Select

Now I need to come down 4 more rows and over 14 columns. I don't want to
use Cell References. I want to use relative references if at all possible.

How do I do that???

Your help is much appreciated.
--

Emma
www.bardpv.com
Tempe, Arizona

Dave Peterson

Expand a range by rows and columns
 

Do you want A1 through the last used row in column A then extended to 14
columns?

Dim myRng as range
dim LastRow as long
with activesheet
LastRow = .cells(.rows.count,"A").end(xlup).row
set myrng = .range("A1", .cells(lastrow + 4, 14))
end with

myrng.select 'you probably don't have to select the range to work with it.



Emma Aumack wrote:

Hi All,

I need to know how to expand a range by 2 rows. Here is what I have:

FinalRow = Range("A1").End(xlDown).Select

Now I need to come down 4 more rows and over 14 columns. I don't want to
use Cell References. I want to use relative references if at all possible.

How do I do that???

Your help is much appreciated.
--

Emma
www.bardpv.com
Tempe, Arizona


--

Dave Peterson

Jacob Skaria

Expand a range by rows and columns
 
Another way using Resize..

Sub Macro()
Dim myRange As Range, finalRow As Long
finalRow = Range("A1").End(xlDown).Row
Range("A1").Resize(finalRow + 2, 14).Select
Set myRange = Range("A1").Resize(finalRow + 2, 14)
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Emma Aumack" wrote:

Hi All,

I need to know how to expand a range by 2 rows. Here is what I have:

FinalRow = Range("A1").End(xlDown).Select

Now I need to come down 4 more rows and over 14 columns. I don't want to
use Cell References. I want to use relative references if at all possible.

How do I do that???

Your help is much appreciated.
--

Emma
www.bardpv.com
Tempe, Arizona



All times are GMT +1. The time now is 12:06 PM.

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