I have about 4000 cells, each with about 4 separate lines of text. Each line of texts has been entered using the ALT+ENTER method.
Can anybody suggest a way, either VBA or Excel command/method to convert each of of these cells into one line, with spaces between the words.
Example: Current Cell 1:
Need: Cell 1:
Any help is much appreciated
Type = and select the first cell you want to combine. Type & and use quotation marks with a space enclosed. Select the next cell you want to combine and press enter. An example formula might be =A2&" "&B2.
On the Home tab, in the Alignment group, click Wrap Text. (On Excel for desktop, you can also select the cell, and then press Alt + H + W.) Notes: Data in the cell wraps to fit the column width, so if you change the column width, data wrapping adjusts automatically.
To do this without VBA:
Use find and replace.
In the find what box, hold ALT and type 0010
(ASCII code for line feed is 10 - you will not see anything, but it's a new line character).
In the replace box, simply type a space character or any delimiter.
Click on Replace all
buttton.
Try this short macro:
Sub dural()
Dim rng As Range
Set rng = Selection
rng.Replace what:=Chr(10), lookat:=xlPart, replacement:=" "
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With