View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ryan H Ryan H is offline
external usenet poster
 
Posts: 489
Default How can I delete a space/character from a number of fields?

If you need code you can use this. Just change the range to fit your
application. Hope this helps! If so, let me know, click "YES" below.

Sub ReplaceHyphens()

Dim MyRange As Range

Set MyRange = Range("A:A")
MyRange.Replace What:="-", Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, _
MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

End Sub
--
Cheers,
Ryan


"BABs" wrote:

I have a column that has hyphenated numbers (XX-XX-XX-XXX-XXXX) and I need to
get rid of the hyphens. They are all in the same format so I think if I
could write code to del the 3rd, 6th, 9th, etc characters from a cell, it
would work. I just can't seem to figure the code out. or is there an easier
way?
Thx.