Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to remove linebreaks in cells with VBA
I have some excel files that I save as comma delimited text files in order to
import them into a Mysql database. However, some text cells have linebreaks in them, which results in the part after the linebreak being put onto a new line in the comma delimited text file. The mysql import script treats it as a new record, which should not be the case. So I want to make a macro that checks all the cells and removes any linebreaks in them. Can anyone show me how to do that? Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to remove linebreaks in cells with VBA
Hi Ozzmantsje,
Try somethinhg like: '============= Public Sub Tester() Dim WB As Workbook Dim SH As Worksheet Set WB = Workbooks("MyBook.xls") '<<==== CHANGE Set SH = WB.Sheets("Sheet1") '<<==== CHANGE SH.Cells.Replace What:=Chr(10), _ Replacement:=vbNullString, _ LookAt:=xlPart, _ SearchOrder:=xlByRows, _ MatchCase:=False End Sub '<<============= --- Regards, Norman "Ozzmantsje" wrote in message ... I have some excel files that I save as comma delimited text files in order to import them into a Mysql database. However, some text cells have linebreaks in them, which results in the part after the linebreak being put onto a new line in the comma delimited text file. The mysql import script treats it as a new record, which should not be the case. So I want to make a macro that checks all the cells and removes any linebreaks in them. Can anyone show me how to do that? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do i remove the 0 in the cells | Excel Discussion (Misc queries) | |||
how do I insert forced linebreaks in cells in Excel | Excel Discussion (Misc queries) | |||
how do I shift the contents of the cells up to remove empty cells. | Excel Discussion (Misc queries) | |||
Remove ' from cells | Excel Discussion (Misc queries) | |||
Remove Blank Cells within each row | Excel Programming |