views:

44

answers:

1

I am splitting a line of text into an array then attempting to put into a new array without the null spaces. For some reason it's not copying from the old array into the new one. BTW if someone has a more efficient way of doing this I am open to that as well.

Dim x As Variant, i As Integer, m As String, rdate As String, k(0 To 50) As Variant, j As Integer
rdate = ThisWorkbook.Sheets("sheet1").Range("a58").Value
j = 0
x = Split(rdate, "  ")

For i = 0 To UBound(x)
    If x(i) <> "" Then
        k(j) = x(i)
        j = j + 1
        m = m & j & k(j) & vbCrLf
    End If
Next
MsgBox m
+1  A: 

Your script is adding k(j) AFTER incrementing j... your msgbox appears empty.

helios
nuts! that worked thanks
Anthony
Yeah, I had to execute it, in fact... :)
helios