+ Reply to Thread
Results 1 to 5 of 5

Remove Line-Spacing (Alt-Enter)

  1. #1
    Forum Contributor
    Join Date
    02-09-2015
    Location
    malta
    MS-Off Ver
    Microsoft 365
    Posts
    383

    Remove Line-Spacing (Alt-Enter)

    Hi all,

    I have the following code, which basically adds a line-space (Alt+Enter)to all the cells found in Column D in a worksheet called "Sheet 1". The line spacing applied to each cell is included before and after the text found within each cell. Therefore, for example, each cell will look like this:

    (Alt-Enter)
    "Text"
    (Alt-Enter)



    Is it possible to revert the VBA, or make another VBA to REMOVE the line-spacing (both line-spacing before and after) and leave just the text?

    Thanks a lot everyone

    Kindly find the code below:



    Sub AutoFit()

    For i = 1 To Worksheets("Sheet1").Cells(Rows.Count, "D").End(xlUp).Row
    Worksheets("Sheet1").Cells(i, "D") = Chr(10) & Worksheets("Sheet1").Cells(i, "D").Text & Chr(10)
    Next i

    End Sub

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Remove Line-Spacing (Alt-Enter)

    Hi Keibri,
    try
    Please Login or Register  to view this content.
    PS tags for the code are behind the # button

  3. #3
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Remove Line-Spacing (Alt-Enter)

    Please Login or Register  to view this content.
    !If all your troubles are solved, then so is the thread. Show this by marking it so using thread tools at the top of the page.
    If I helped do this, then please show your appreciation by awarding rep points.
    <------ Button for that is over there

  4. #4
    Forum Contributor
    Join Date
    02-09-2015
    Location
    malta
    MS-Off Ver
    Microsoft 365
    Posts
    383

    Re: Remove Line-Spacing (Alt-Enter)

    Thanks guys Tested the first Solution and it worked wonders!

    Testing the second solution.


  5. #5
    Forum Contributor
    Join Date
    02-09-2015
    Location
    malta
    MS-Off Ver
    Microsoft 365
    Posts
    383

    Re: Remove Line-Spacing (Alt-Enter)

    The second works as well. Cheers guys

+ 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] MultiLine Textbox to auto remove blank line, count line, remove duplicate
    By khhoa in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-24-2015, 09:28 PM
  2. [SOLVED] Need to Remove Alt+Enter from end of line, keep other Alt+Enter in place
    By jaimelwilson in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-04-2013, 10:23 PM
  3. Remove all text after 1st comma and Remove the -,NE and spacing
    By Tan Bee Hock in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-06-2008, 06:28 AM
  4. [SOLVED] how do I remove fx from the function line, can't enter data
    By dmdranch in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 12-03-2005, 02:55 PM
  5. Remove Line Breaks ALT + ENTER
    By Highman in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-26-2005, 05:06 PM

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