Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
getting value of named range
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
getting value of named range
Is there a particular order that it needs to follow? What do the
cells hold? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 Not enough data to be sure what you really want, but brute force should work: ===================== Sub foo() Dim c As Range Dim a As String For Each c In Range("MyRange") a = a & c.Value Next c Debug.Print a End Sub ==================== --ron |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
getting value of named range
Dim myArray
myArray = Application.Transpose(Range("myRange")) MsgBox myArray(1) -- __________________________________ HTH Bob "greg" wrote in message ... 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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
getting value of named range
thanks all,
I will look into the looping "greg" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Referencing a named range based upon Range name entry in cell | Excel Worksheet Functions | |||
Array as a "named range" - formula ok in cells, but error as "named range" | Excel Discussion (Misc queries) | |||
inserting a named range into new cells based on a named cell | Excel Discussion (Misc queries) | |||
Compare a selected Range with a Named range and select cells that do not exist | Excel Programming | |||
If any cell in named range = 8 then shade named range | Excel Programming |