Results 1 to 6 of 6

Thread: Finding replace text or symbol with carriage return in Excel

  1. #1
    Join Date
    Feb 2012
    Posts
    9

    Finding replace text or symbol with carriage return in Excel

    I am using Microsoft Excel 2003. I need to how to find text or symbol in each cell and replace with hard carriage return.

  2. #2
    Join Date
    Jun 2011
    Posts
    635

    Re: Finding replace text or symbol with carriage return in Excel

    You could use edit and replace. Say that you wanted to replace the pound sign (#) with the hard line break (CHAR(10)). First, select the cells containing the data to be changed, then: click on Edit > Replace. In the "Find What" box, enter # and in the "Replace With" box, enter <ALT>0010. Using the numbers on the num keypad, *not* the numbers under the function keys. You will not see anything displayed in the "Replace With" box, But click "Replace All". You should see your data wrapped in the cell. If not, go to: click on Format> Cells > Alignment > tab and click in "Word Wrap", then > OK.

  3. #3
    Join Date
    Jun 2011
    Posts
    487

    Re: Finding replace text or symbol with carriage return in Excel

    I have this same questions and This answer did not not work for me. It is inserting"<alt>0010". Not a hard return. When replacing with: hold the ALT key and type 0010 on the NumPad(gray keys on the right). You won't see anything typed in the box, but it is there.

  4. #4
    Join Date
    Jun 2011
    Posts
    798

    Re: Finding replace text or symbol with carriage return in Excel

    Where can I find a list defining all the key codes / values like ALT 0010 = carriage return. I assume they will be the same for all MS office apps.

  5. #5
    Join Date
    May 2011
    Posts
    448

    Re: Finding replace text or symbol with carriage return in Excel

    When I record a macro with the find function I get this :
    Code:
    Selection.Find(What:="874", After:=ActiveCell, LookIn:=xlValues, LookAt _
    :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
    MatchCase:= _
    False, SearchFormat:=False).Activate
    What I need to do is replace the "874" with a value on sheet 2 and find the value in sheet 1. But I don't know how to do that. I've tried about everything I know and I get nothing that works. Things like Sheets("Sheet2").Range("A1").value calling it MyFindValue. Nothing been at this for weeks now. How can I get the macro to reread a value in sheet 2 to activate the same value in sheet 1? If I can get that to work I can get the rest of it to work. The macro is recorded as relative. I am sure there is a way to get it to read the cell in sheet 2 I am just no getting it please help. This is part of a much bigger problem and the only pitfall I have.

  6. #6
    Join Date
    May 2011
    Posts
    410

    Re: Finding replace text or symbol with carriage return in Excel

    If you're sure that the value exists in the selection, you can use something like:
    Code:
    Selection.Find( _
    What:=Sheets("Sheet2").Range("A1").Value, _
    LookIn:=xlValues, _
    LookAt:=xlPart, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:= False).Activate
    However, if it doesn't, you'll get an error. You can use a variable to check if it exists:
    Code:
    Dim rFound As Range
    Set rFound = Selection.Find( _
    What:=Sheets("Sheet2").Range("A1").Value, _
    LookIn:=xlValues, _
    LookAt:=xlPart, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:= False)
    If rFound Is Nothing Then
    MsgBox """" & Sheets("Sheet2").Range("A1").Value & _
    """ was not found."
    Else
    rFound.Activate
    End If

Similar Threads

  1. Replies: 4
    Last Post: 19-02-2012, 02:17 PM
  2. Replies: 2
    Last Post: 17-02-2012, 01:03 PM
  3. How to find replace text in Excel
    By Chini mao in forum Windows Software
    Replies: 3
    Last Post: 07-01-2012, 11:44 AM
  4. Finding the text in URL with PHP.
    By SoftwareGuy in forum Tips & Tweaks
    Replies: 3
    Last Post: 12-03-2011, 08:29 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,870,322.66476 seconds with 17 queries