Posted to microsoft.public.excel.programming
|
|
using formula - extract text separated by 2 spaces
On Sunday, June 19, 2016 at 10:35:44 PM UTC+4, isabelle wrote:
i,
'Claus's solution
Sub Macro1()
lLastRow = Cells(Rows.Count, 4).End(xlUp).Row
Range("E1:K" & lLastRow).Formula = "=TRIM(MID(SUBSTITUTE($D1,"" "",REPT(""
"",99)),COLUMN(A1)*99-98,99))"
End Sub
'Garry's solution
Sub ParseValues2()
Dim vData, vTmp, lLastRow&, n&
lLastRow = Cells(Rows.Count, 4).End(xlUp).Row
vData = Range("D1:D" & lLastRow)
For n = 1 To UBound(vData)
vTmp = Split(vData(n, 1), " ")
Range("E" & n).Resize(1, UBound(vTmp) + 1) = vTmp
ActiveSheet.UsedRange.Columns.AutoFit
Next
End Sub:
i tried both solutions and they work very well.
http://www.cjoint.com/c/FFtsG7PX7na
isabelle
Le 2016-06-19 Ã* 13:57, ANG a écrit :
Dear Claus
Sorry to bother again - but can you give me the vba code which would get the same result as the above formula if all data are in column D
thxs
Thxs Isa (:-)
|