Share via

How to solve this format issue?

Anonymous
2024-09-05T07:21:55+00:00

I am currently facing an issue including three different items, they appear as three items under one line. 

![](https://learn-attachment.microsoft.com/api/attachments/1baf4b4d-8a2b-4d39-8643-d74166e09090?platform=QnA

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2024-09-07T12:07:45+00:00

    Hi,

    sample

    select 3 cells C1:E1

    pic1

    Image

    .

    and run the below vba

    result

    pic2

    Image

    '

    '==================

    Sub Split_Selection_Range()

    '07-09-2024

    Dim rng, x, y, N, v, vv, t

    If MsgBox("Select the range ??", vbOKCancel) = vbCancel Then Exit Sub

    Set rng = Selection

    For x = 1 To 3

    If x <= 2 Then

    N = Len(rng.Item(x))

    For y = 1 To N

    Cells(rng.Row + y, rng.Item(x).Column) = Mid(rng.Item(x), y, 1)

    Next y

    Else

    v = Split(rng.Item(3), vbLf)

    t = 1

    For Each vv In v

    Cells(rng.Row + t, rng.Item(x).Column).Value = vv

    t = t + 1

    Next vv

    End If

    Next x

    End Sub

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2024-09-05T08:39:27+00:00

    Hi oemSoft,

    Thanks for posting in Microsoft Community.

    Based on the screenshot you provided, it appears that you want to split the text within a cell into separate cells based on the "line breaks" contained within the text.

    In fact, Excel can automatically recognize line breaks when pasting and will distribute the text across different cells.

    In the current version of Excel, for text within cell A1, you need to double-click into the cell and select all the text, then copy it. (Note: do not directly copy the entire cell A1.) Select any cell (do not double-click to enter edit mode), right-click and paste or use Ctrl+V to paste, at this point Excel will automatically distribute the text from different lines into separate cells.

    If you have any further questions, please feel free to reply to me.

    Best Regards,

    Jonathan Z - MSFT | Microsoft Community Support Specialist

    Was this answer helpful?

    0 comments No comments