Consulting

Results 1 to 4 of 4

Thread: How to replace a particular element in a cell

  1. #1

    How to replace a particular element in a cell

    Hi,

    I have this type of column :

    167'1160'1147'3136'0-84 93'0 80'0 62'0 52'0

    Here I want to replace " ' " with " . " if it is there. Please note that all element of that column do not contain " ' ". Is there any simple procedure to do that?

  2. #2
    VBAX Tutor Benzadeus's Avatar
    Joined
    Dec 2008
    Location
    Belo Horizonte, Brazil
    Posts
    271
    Location
    [VBA]Sub ReplaceChar()
    ActiveCell = Replace(ActiveCell, "'", ".")
    End Sub[/VBA]

  3. #3
    VBAX Tutor Benzadeus's Avatar
    Joined
    Dec 2008
    Location
    Belo Horizonte, Brazil
    Posts
    271
    Location
    If you want in entire column:
    [VBA]Sub ReplaceCharCol()

    Dim rng As Range, cl As Range
    Set rng = Range(Cells(1, ActiveCell.Column), Cells(Cells(65536, ActiveCell.Column).End(xlUp).Row, ActiveCell.Column))

    For Each cl In rng
    cl.Value = Replace(cl.Value, "'", ".")
    Next cl
    End Sub[/VBA]

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Just use the Excel Replace option, Ctrl-H
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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