+ Reply to Thread
Results 1 to 4 of 4

VBA macro to to INSERT Alt-Enter line break in Cell

  1. #1
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Panama City, FL
    MS-Off Ver
    Excel 2016
    Posts
    175

    VBA macro to to INSERT Alt-Enter line break in Cell

    Hello Excel friends,

    I'd greatly appreciate if someone can show me how to write a macro in VBA to go to each cell in COLUMN E beginning with ROW 3 and replacing ", " (that's a comma followed by a space which separates Lname and Fname) with ",{alt-enter}".
    What I'm doing with this is replacing the space following the first (and only) comma in the NAME field with an ALT-ENTER to put the Fname/Mname on the second line of the cell.

    Schmoe, Joseph Chris will become:

    Schmoe,
    Joseph Chris.

    Thanks very much for any assistance!

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,741

    Re: VBA macro to to INSERT Alt-Enter line break in Cell

    No need for a macro, just select the column, Ctrl H in the Find What box put ", " (without the quotes) & in the Replace with box put , Ctrl J. Then Click replace all

  3. #3
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Panama City, FL
    MS-Off Ver
    Excel 2016
    Posts
    175

    Re: VBA macro to to INSERT Alt-Enter line break in Cell

    Thank you Fluff13. I actually tried that, but did not know about the Ctrl-J. Rather, I tried Replace with: , & Alt-enter and that didn't work. Easier is better - thanks!

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,741

    Re: VBA macro to to INSERT Alt-Enter line break in Cell

    You're welcome & thanks for the feedback.

    If you need a macro, you can simply record yourself doing it manually.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Insert a Line Break in a Cell
    By mgraf in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-23-2018, 04:43 PM
  2. [SOLVED] VBA code to insert line break within a cell if specific criteria is met.
    By pipoliveira in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-19-2018, 09:28 AM
  3. [SOLVED] VBA for Line Break (Alt- Enter)
    By Keibri in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-28-2015, 06:29 AM
  4. [SOLVED] Enter Line-Break [Alt + Enter] at specific location
    By jewelsharma in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-27-2014, 12:23 AM
  5. [SOLVED] VBA to insert line break (Alt+Enter)
    By TextMonkey in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-12-2014, 01:18 PM
  6. [SOLVED] Macro to insert line break between rows
    By ulyhappy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2012, 12:00 PM
  7. [SOLVED] How do I enter a line break within a cell?
    By Striving for efficiency in forum Excel General
    Replies: 4
    Last Post: 11-17-2005, 04:15 PM

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1