Working with a selected range

O

OkieViking

How do you name a selected range? How do you determine the dimensions of the range (top left corner to bottom right corner)?

Thanks
 
L

LarryN

Select your range and then
on the menu:
Insert - Name - Define -

Type a name and click OK.

-----Original Message-----
How do you name a selected range? How do you determine
the dimensions of the range (top left corner to bottom
right corner)?
 
B

Bernie Deitrick

Okie,

Selection.Name = "Fred"
MsgBox "First cell of Fred is " & _
Range("Fred").Cells(1).Address
MsgBox "Last cell of Fred is " & _
Range("Fred").Cells(Range("Fred").Cells.Count).Address
MsgBox "Fred covers " & Range("Fred").Rows.Count & " Rows"
MsgBox "Fred covers " & Range("Fred").Columns.Count & " Columns"

HTH,
Bernie
MS Excel MVP

OkieViking said:
How do you name a selected range? How do you determine the dimensions of
the range (top left corner to bottom right corner)?
 
O

OkieViking

I am trying to write a macro in which the user will select a range and then activate the macro. The macro will then manipulate the range. But to be able to do that I need to name the range so I can get back to it, and also define the size and location of the selected range.
 
Top