Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do you programically remove carriage returns within a cell
I need to do more than one cell at a time.
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do you programically remove carriage returns within a cell
lee type your question the body of the text please.
sub removecarret() dim cel as range for each cel in activesheet.usedrange cel = replace(cel,chr(13),"") next end sub UNTESTED but it should work -- When you lose your mind, you free your life. "Lee" wrote: I need to do more than one cell at a time. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do you programically remove carriage returns within a cell
Saved from a previous post to a more generic question:
You can use Chip Pearson's Cell View addin to find out the character it is: http://www.cpearson.com/excel/CellView.htm If those box characters are char(10)'s (alt-enters), you can use edit|Replace what: ctrl-j with: (spacebar??) replace all If that box character is something else, you may need a macro: Option Explicit Sub cleanEmUp() Dim myBadChars As Variant Dim myGoodChars As Variant Dim iCtr As Long myBadChars = Array(Chr(13)) '<--What showed up in CellView? myGoodChars = Array(" ") If UBound(myGoodChars) < UBound(myBadChars) Then MsgBox "Design error!" Exit Sub End If For iCtr = LBound(myBadChars) To UBound(myBadChars) ActiveSheet.Cells.Replace What:=myBadChars(iCtr), _ Replacement:=myGoodChars(iCtr), _ LookAt:=xlPart, SearchOrder:=xlByRows, _ MatchCase:=False Next iCtr End Sub If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Lee wrote: I need to do more than one cell at a time. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I remove carriage returns from a cell | Excel Worksheet Functions | |||
Remove carriage returns in an Excel document? | Excel Discussion (Misc queries) | |||
How do I eliminate carriage returns in a cell | Charts and Charting in Excel | |||
how do I remove Carriage Returns from a column in a spreadsheet? | Excel Discussion (Misc queries) | |||
How do I automatically remove carriage returns in Excel? | Excel Discussion (Misc queries) |