ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help seperate Arrays (https://www.excelbanter.com/excel-programming/384737-help-seperate-arrays.html)

[email protected]

Help seperate Arrays
 
I'm certain this is not very difficult, but for some reason I am
having difficulty accomplishing what I want.
iobj_dom could contain values like AB, AC, AD2, AF etc. When I write
it I want the values seperated by commas as shown, but what I get is
ABACAD2AF. There could be 1 to ??? elements in the array.

For Each iobj_node In iobj_dom.documentElement.childNodes
ReDim sys(iSys)
sys(iSys) = iobj_node.childNodes(0).Text
iSys = iSys + 1
Next
Range("C" + CStr(ll_range)).Value =
iobj_dom.documentElement.Text

Thanks in advance,
Gabe


[email protected]

Help seperate Arrays
 
Accomplished what I wanted using the following code. If anyone has a
better way to do this please let me know.

Thanks,
Gabe

If iobj_dom.documentElement.childNodes.Length 1 Then
For Each iobj_node In iobj_dom.documentElement.childNodes
ReDim sys(iSys)
sys(iSys) = iobj_node.childNodes(0).Text
Range("D" + CStr(ll_range)).Value = (Range("D" +
CStr(ll_range)).Value + sys(CLng(iSys)) + ", ")
iSys = iSys + 1
Next
strLength = Len(Range("D" + CStr(ll_range)).Value)
Range("D" + CStr(ll_range)).Value = Left(Range("D" +
CStr(ll_range)).Value, (strLength - 2))
ElseIf iobj_dom.documentElement.childNodes.Length = 1 Then
Range("D" + CStr(ll_range)).Value =
iobj_dom.documentElement.Text
End If




All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com