ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using A Macro To Name A 2-dimensional Range (https://www.excelbanter.com/excel-programming/316002-using-macro-name-2-dimensional-range.html)

Chuckles123[_45_]

Using A Macro To Name A 2-dimensional Range
 

This is so easy in a spreadsheet. I want the macro to name
two-dimensional range: the left-most column and the right-most colum
are fixed; the bottom row is the last row of the spreadsheet (but, thi
is a variable); the top row is a fixed number of rows above the botto
row; and, there are some empty cells in the range.

How much harder can it be in a macro???

Thanks for a response.
Chuckles12

--
Chuckles12
-----------------------------------------------------------------------
Chuckles123's Profile: http://www.excelforum.com/member.php...fo&userid=1494
View this thread: http://www.excelforum.com/showthread.php?threadid=27594


Myrna Larson

Using A Macro To Name A 2-dimensional Range
 
Maybe something like this will help:

Const LeftCol = 3
Const RightCol = 10
Const NumRows = 30

Dim BottomRow As Long

BottomRow = Cells(Rows.Count, LeftCol).End(xlUp).Row
TopRow = BottomRow - NumRows + 1
Range(Cells(TopRow, LeftCol), Cells(BottomRow, RightCol)).Name = "SomeName"


On Sat, 6 Nov 2004 16:23:10 -0600, Chuckles123
wrote:


This is so easy in a spreadsheet. I want the macro to name a
two-dimensional range: the left-most column and the right-most column
are fixed; the bottom row is the last row of the spreadsheet (but, this
is a variable); the top row is a fixed number of rows above the bottom
row; and, there are some empty cells in the range.

How much harder can it be in a macro???

Thanks for a response.
Chuckles123




All times are GMT +1. The time now is 06:58 AM.

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