|
|
|
|
|
|
Excel
|
Remove Carriage / Paragraph Returns from Within Cells
|
|
Ease of Use
|
Easy
|
Version tested with
|
2000, 2002, 2003
|
Submitted by:
|
Anne Troy
|
Description:
|
Removes carriage returns placed by using Alt+Enter in the entire Activesheet.
|
Discussion:
|
This macro will remove returns created by hitting Alt+Enter within cells in Excel, and replace them with a space.
|
Code:
|
instructions for use
|
Option Explicit
Sub RemoveRtns()
Dim cel As Range
For Each cel In ActiveSheet.UsedRange
cel = Replace(cel, Chr(10), " ")
Next
End Sub
|
How to use:
|
- Copy above code.
- In Excel press Alt + F11 to enter the VBE.
- Press Ctrl + R to show the Project Explorer.
- Right-click desired file on left (in bold).
- Choose Insert -> Module.
- Paste code into the right pane.
- Press Alt + Q to close the VBE.
- Save workbook before any other changes.
|
Test the code:
|
- Navigate to the worksheet on which you want to run the code, and hit Tools-->Macro, Macros, and double-click RemoveRtns.
|
Sample File:
|
RemoveRtns.zip 6.77KB
|
Approved by mdmackillop
|
This entry has been viewed 216 times.
|
|