ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Working with a selected range (https://www.excelbanter.com/excel-programming/301074-working-selected-range.html)

OkieViking

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

Thanks

larryN

Working with a selected range
 
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)?

Thanks
.


Bernie Deitrick

Working with a selected range
 
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).Add ress
MsgBox "Fred covers " & Range("Fred").Rows.Count & " Rows"
MsgBox "Fred covers " & Range("Fred").Columns.Count & " Columns"

HTH,
Bernie
MS Excel MVP

"OkieViking" wrote in message
...
How do you name a selected range? How do you determine the dimensions of

the range (top left corner to bottom right corner)?

Thanks




OkieViking

Working with a selected range
 
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.


"LarryN" wrote:

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)?

Thanks
.




All times are GMT +1. The time now is 04:57 PM.

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