Hi there,
I have set up an userform to input checklist question and requirement. I'm using the code below to split multiple lines to multiple rows. It works, but for only one cell. I would really appreciate your help on this matter, how to make this apply to the whole column A and B instead of just one cell.
Sample of Input
Sample of output
I have set up an userform to input checklist question and requirement. I'm using the code below to split multiple lines to multiple rows. It works, but for only one cell. I would really appreciate your help on this matter, how to make this apply to the whole column A and B instead of just one cell.
VBA Code:
Sub Question()
Dim cel As Range
Dim SplitText
For Each cel In Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row)
SplitText = Split(cel, vbLf)
If UBound(SplitText) > 0 Then 'If successful it will be > 0
'
Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row).Resize(UBound(SplitText) + 1).Value = Application.Transpose(SplitText)
End If
Next cel
End Sub
Sub Requirement()
Dim cel1 As Range
Dim SplitText1
For Each cel1 In Range("B2:B" & Range("B" & Rows.Count).End(xlUp).Row)
SplitText1 = Split(cel1, vbLf)
If UBound(SplitText1) > 0 Then 'If successful it will be > 0
Range("B2:B" & Range("B" & Rows.Count).End(xlUp).Row).Resize(UBound(SplitText1) + 1).Value = Application.Transpose(SplitText1)
End If
Next cel1
End Sub
Sample of Input
Sample of output