PDA

View Full Version : How to replace a particular element in a cell



arrun
12-18-2008, 04:43 AM
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?

Benzadeus
12-18-2008, 04:57 AM
Sub ReplaceChar()
ActiveCell = Replace(ActiveCell, "'", ".")
End Sub

Benzadeus
12-18-2008, 05:09 AM
If you want in entire column:
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

Bob Phillips
12-18-2008, 07:25 AM
Just use the Excel Replace option, Ctrl-H