Results 1 to 3 of 3

Remove spaces and replace with comma.

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Remove spaces and replace with comma.

    HI I have a csv file which seems a little cracy, and i would like a way to be able to work with it.
    I need to remove the spaces and and properly also the special caracters and replace them with a comma.
    And then save the csv file again. I have tried to record find replace, but it put allot of commas inside, i only need one between.
    I found below code, which maybe can be usefull. it remove all spaces, so i need that one to be maybe able to put a comma between.

    Please have a look
    Put a test sheet here and some lines of the csv file is in sheet 2

    Sincerely Abjac

    Here is the code which remove all spaces.

    Sub TrimBText()
    ' This module will trim extra spaces from BOTH SIDES.
        Dim MyCell As Range
        On Error Resume Next
            Selection.Cells.SpecialCells(xlCellTypeConstants, 23).Select
            For Each MyCell In Selection.Cells
                MyCell.Value = Trim(MyCell.Value)
            Next
        On Error GoTo 0
    End Sub
    Attached Files Attached Files

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