View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Lars-Åke Aspelin[_2_] Lars-Åke Aspelin[_2_] is offline
external usenet poster
 
Posts: 913
Default getting value of named range

On Fri, 20 Jun 2008 14:27:48 -0500, "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(MyWorkshee t).Range(MyRange).value

any ideas



try this:

Function all_values_in_one_string(r As Range) As String
Dim s As String
For Each c In r
s = s & c.Value
Next c
all_values_in_one_string = s
End Function

Hope this helps / Lars-Åke