VBA - Convert my variable range array to single cell string
Or:
Sub test()
Dim sStr As String
Dim cell As Range
sStr = ""
For Each cell In Range("J9:J520")
sStr = sStr & IIf(sStr = "", "", ", ") & cell.Value
Next
ActiveCell.Value = sStr
End Sub
Rob
"Tom Ogilvy" wrote in message
...
Dim sStr as String
Dim cell as Range
sStr = ""
for each cell in Range("J9:J520")
sStr = sStr & cell.Value & ", "
Next
sStr = Left(sStr,len(sStr)-2)
ActiveCell.Value = sStr
--
Regards,
Tom Ogilvy
Kevin G wrote in message
news:bKGRb.19363$P51.11833@clgrps12...
1, 2, 3, etc
I have 512 cells each with 3 numerals.
Thanks, Kevin Graham
"Tom Ogilvy" wrote in message
...
Assume you had a range J9:J11
J9: 1
J10: 2
J11: 3
What would you expect to see in the single cell?
--
Regards,
Tom Ogilvy
Kevin G wrote in message
news:LZFRb.19360$P51.3159@clgrps12...
I have a range a cells J9:J520 (this range only used for a chart
series)
and I am trying to convert this to a string so it can be pasted into
a
single cell. I would like to convert this back to a variable range
when
needed to chart again.
Thanks, Kevin
|