How to split the Cell Content

akhendre88

Board Regular
Joined
Sep 17, 2015
Messages
76
Hello,

I receive an auto generated sheet every day in which multiple lines are combined in only one cell.

Every line ends with either ' or ). My objective here is to get each line in different cell. How can I get this done?

Will split() be useful in this scenario or is there any other way?

Thank you.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hello,

I receive an auto generated sheet every day in which multiple lines are combined in only one cell.

Every line ends with either ' or ). My objective here is to get each line in different cell. How can I get this done?

Will split() be useful in this scenario or is there any other way?
Do you have only one column of data to process? If not, then what should be done with the other columns of data?
 
Upvote 0
No, there will be only one column.

Currently, I have all the data in 'A1', and I want to split it in such a way that first line should go in A1, 2nd in A2 and so on...!!

Thank you.
 
Upvote 0
No, there will be only one column.

Currently, I have all the data in 'A1', and I want to split it in such a way that first line should go in A1, 2nd in A2 and so on...!!
Give this macro a try...
Code:
[table="width: 500"]
[tr]
	[td]Sub SplitDataInCellA1()
  Dim Arr As Variant
  Arr = Split(Range("A1"), vbLf)
  Range("A1").Resize(UBound(Arr) + 1) = Application.Transpose(Arr)
End Sub[/td]
[/tr]
[/table]
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top