Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am copying data into excel where line feeds in the original data are
represented by #. I want to do a find and replace all # with a new line (alt + enter) in a cell. How can I do this easily? Or if not easily, with a macro? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
Adapt following macro to your needs : Sub Macro1() Cells.Find(What:="#", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _ .Activate ActiveCell.Replace What:="#", Replacement:=Chr(10), LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False End Sub HTH |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Carim,
This doesn't seem to be working. I need to be able to select a column and search and replace all occurrences of "#" in ALL populated cells in the column. Is there an equivalent Cell.ReplaceAll function I can use? I'm afraid my knowledge of creating Macros is limited to "Record" and "Stop". Thanks in advance, R "Carim" wrote: Hi, Adapt following macro to your needs : Sub Macro1() Cells.Find(What:="#", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _ .Activate ActiveCell.Replace What:="#", Replacement:=Chr(10), LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False End Sub HTH |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
Select a range and then run macro ... Sub Macro1() Dim cell As Range For Each cell In Selection Cells.Find(What:="#", After:=cell, LookIn:=xlFormulas, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _ .Activate cell.Replace What:="#", Replacement:=Chr(10), LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False Next cell Range("A1").Select End Sub HTH |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Works superbly. Thanks.
"Carim" wrote: Hi, Select a range and then run macro ... Sub Macro1() Dim cell As Range For Each cell In Selection Cells.Find(What:="#", After:=cell, LookIn:=xlFormulas, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _ .Activate cell.Replace What:="#", Replacement:=Chr(10), LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False Next cell Range("A1").Select End Sub HTH |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Glad it fixed your problem ...
Thanks for the feedback |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Another option is to replace all the # with that newline in one command.
Record a macro when you: select all the cells edit|Replace what: # with: ctrl-j replace all rmellison wrote: I am copying data into excel where line feeds in the original data are represented by #. I want to do a find and replace all # with a new line (alt + enter) in a cell. How can I do this easily? Or if not easily, with a macro? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find and Replace where there are line breaks | Excel Discussion (Misc queries) | |||
find-replace box should not float but be fixed line on tool bar | Excel Worksheet Functions | |||
How can I do a find and replace for a cell that has multiple line. | Excel Discussion (Misc queries) | |||
Adding line breaks by using find and replace | Excel Discussion (Misc queries) | |||
Find/Replace carriage return & line feed characters in Excel. | Excel Worksheet Functions |