View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default Address of selected range

Hi Pieter

Dim chrtrng as Range

not as String, then it will work.

Best regards,
Per


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