Extracting text from cell that is separated by lines

I am new to this sort of task, and I am very confused with how to extract some text from Cell.

This sounds very basic, but let me explain. I have exported some information on some roles for some of my employees, but it has put all of the information into a single cell in the following format:

Production Line




Working with Operations Manager




Oversee Production Line

and so on.

Problem is this that this is all separated by spaces and lines. Is there a way to separate the information into however many paragraphs there are, each into an individual cell?

Again, let me explain.

Cell A1 - Production Line
Cell A2 - working with operations Manager
Cell A3 - Oversee Production Line

Another problem, there is an undetermined number of characteristics.

Thank you for all of your help.

728x90

1 Answers Extracting text from cell that is separated by lines

Assuming that the text is in cell B1 (can be easily changed) you could use VBA to do it:

Sub ExtractFromCell()

    Dim lines() As String
    Dim i As Integer, a As Integer

    a = 1
    lines = Split(Range("B1"), Chr(10))

    For i = LBound(lines) To UBound(lines)
        If lines(i) <> "" Then
            Cells(a, 1) = lines(i)
            a = a + 1
        End If
    Next


End Sub

4 months ago