+ Reply to Thread
Results 1 to 5 of 5

Cleaning up data for printing & deleting useless spaces

  1. #1
    Registered User
    Join Date
    02-19-2013
    Location
    Wisconsin, WI
    MS-Off Ver
    Excel 2007
    Posts
    37

    Cleaning up data for printing & deleting useless spaces

    ExcelSpaces.jpg

    Curious if there a macro for cleaning up data that has more than 2x spaces. E.g. delete or clear out spaces that are two or more.

    Any suggestion is welcome! Thanks!

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Cleaning up data for printing & deleting useless spaces

    Hi, PaulLor89,

    only guessing as no row numbers are given: if it´s inside a cell look for consecutive line feeds (Chr(10)/vbLf or Chr(13)/vbCr) in a loop and replace the two of them by one.

    Ciao,
    Holger (who´s versions of Excel aren´t able to convert images into worksheets)
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    02-19-2013
    Location
    Wisconsin, WI
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Cleaning up data for printing & deleting useless spaces

    SampleData.xls

    Haha, I've took a screen shot.. The excel file has a ton of rows/data.

    Anywho, I am looking to clean up column I specifically, "Service Specific Notes" but all others will be great too. The data was pulled from an ERP system and whoever entered it is rather messy. I am creating a report that I need to generate on a monthly basis. Would be great to have a macro/code for me to run instead of going into each individual cell and deleting the extra spaces. I don't understand what you mean by (Chr(10)/vbLf or Chr(13)/vbCr) in a loop and replace the two of them by one.... I am a true noob.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Cleaning up data for printing & deleting useless spaces

    Hi, PaulLor89,

    give this code a try:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-19-2013
    Location
    Wisconsin, WI
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Cleaning up data for printing & deleting useless spaces

    Thank you Hahobe, works great!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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