VBA Code:
Dim vA1, vA2
With Worksheets("ANALYTICS")
vA1 = .Range("P1", .Cells(Rows.Count, "P").End(xlUp))
ReDim vA2(1 To UBound(vA1), 1 To 2)
For vN = 1 To UBound(vA1)
vA2(vN, 1) = Split(vA1(vN, 1), ":")(0)
vA2(vN, 2) = Trim(Split(vA1(vN, 1), ":")(1))
Next vN
.Range("Q1").Resize(UBound(vA2), 2) = vA2
End With
what do I need to do to make it handle when there is just ONE cell with data? (i already have an If statement before this code starts so that "if" there are NO cells that contain anything, then it bypasses it completely and jumps down to the Else... but, this doesn't address the situations where these is 1 cell with something.)
In most circumstances there is almost always going to be more than 1, but, occasionally it encounters a situation where there is only 1, and when that happens it doesnt work. ?
(this is what it sees when there is only one cell within "P" with any data.)
usually it encounters a range that looks like this (column "J" this time instead of "P") and it works fine and splits the the cell contents into 2 columns at the " : " location:
So I realize that it's right here when it encounters this:
VBA Code:
ReDim vA2(1 To UBound(vA1), 1 To 2)
that it crashes as theres only 1 so obviously it cant go 'To 2', but I can't figure out how to make it work where there is only 1 (putting in another "If" statement to just skip it wont work either as I still need the code to do just spilt the one cell into two parts like shown above.)
as usual, thanks in advance for any help!!