View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Pieter Vandenberg Pieter Vandenberg is offline
external usenet poster
 
Posts: 6
Default Address of selected range

On Jul 13, 12:01*pm, "Gary Keramidas" <GKeramidasATmsn.com wrote:
not sure if this is what you're looking for or not.

Sub test()
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
Dim rng As Range

Set rng = ws.Range("J2")
* * With ws
* * .Range(rng, .Range(rng.End(xlDown), rng.End(xlToRight))).Name _
* * = "rangename"
End With
MsgBox Range("rangename").Address
End Sub

--

Gary


Hello: Gary:

You suggestion worked perfectly. Along with the other posed suggestion
I now have two ways to do it.
Thank you.
Pieter


"vandenberg p" wrote in message

...

I have the following VBA code (it was recorded):


dim chrtrng as range


* *Range("j2").Select
* *Range(Selection, Selection.End(xlDown)).Select
* *Range(Selection, Selection.End(xlToRight)).Select


* set chrtrng = selection.address
~~~~~~~


I now wish to know how to assign that range a name.
The above set does not work and I can't quite figure the
correct way to do this.


Thanks for any help.


Pieter