View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen[_2_] Per Jessen[_2_] is offline
external usenet poster
 
Posts: 703
Default getting value of named range

On 20 Jun., 21:27, "greg" wrote:
I have a named range. *Lets say it goes over lots of cells.
A1 to E20

Can I get the values out as a string? *Single string.

I have tried some things like:

excel.Workbooks(MyWorkbook).Worksheets(MyWorksheet ).Range(MyRange).value

any ideas


Hi

You need to loop through the cells. Look at this macro, it will loop
through the cells row by row.

Sub NamedRangeToString()
Dim nString As String
For Each c In Range("MyRange").Cells
nString = nString & c.Value
Next
MsgBox nString
End Sub

Regards,
Per