On Jul 13, 12:09*pm, "Rick Rothstein \(MVP -
VB\)"
wrote:
The Address property is a String, so you can't Set it to a Range object. I
guess technically you could do this...
Set chrrng = Range(Selection.Address)
but, since the Selection is already a Range, why not just do this...
Set chrrng = Selection
Rick
Hello Rick:
Thank you for your reply. I tried the following:
Sub xprobchart()
sheetnam = "Distribution 10"
icount = 21
col = 10
Dim chrtrng2 As String
Sheets(sheetnam).Select
Range("j2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Set chrtrng2 = Selection
MsgBox " chrtrng " & chrtrng2
and got a compile error, objective required, for the line: set chrrng2
= selection
The first method you suggested worked just fine.
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