I have a situation wherein one cell contains multi-line text and dates and I need oldest date data and Latest data parsed in new columns.
Like following:-
Sub Demo1() Dim R&, V, D$(1), S$(1) Application.ScreenUpdating = False For R = 2 To ActiveSheet.UsedRange.Rows.Count For Each V In Split(Replace(Cells(R, 1).Value, vbCr, ""), vbLf) V = Split(V, ";") V(1) = Split(V(1), "=")(1) If V(1) > D(0) Then D(0) = V(1) S(0) = V(0) ElseIf V(1) = D(0) Then S(0) = S(0) & vbLf & V(0) End If If V(1) < D(1) Or D(1) = "" Then D(1) = V(1) S(1) = V(0) ElseIf V(1) = D(1) Then S(1) = S(1) & vbLf & V(0) End If Next Cells(R, 2).Resize(, 2).Value = S Erase D, S Next Application.ScreenUpdating = True End Sub
Do you like it ? So thanks to click on bottom left star icon « ★ Add Reputation » !
but little query can we have loop for either of new columns when, generated cell is empty text written in say COLUMN HEADER => product ... respective cell content is copied.
Bookmarks