Delete spaces in a cell containing text
Delete spaces in a cell containing text
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Delete spaces in a cell containing text

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I am looking for a VBA code permitting to delete all the spaces in a cell containing text; the spaces can be before and after the text

    Thanks

  2. #2
    MrExcel MVP Tom Urtis's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, California USA
    Posts
    11,136
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    If I understand you correctly, all you want to do is eliminate spaces within text.

    This macro does that for column A, by replacing a spacebar character with nothing.

    Modify for range; if I'm misinterpreting, please repost.

    Sub DeleteSpaces()
    Columns("A:A").Replace What:=" ", Replacement:="", LookAt:=xlPart, _
    SearchOrder:=xlByColumns, MatchCase:=False
    End Sub

    Tom Urtis

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com