View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Kilmer Bob Kilmer is offline
external usenet poster
 
Posts: 280
Default removing unwanted characters in a cell

In VBA, Replace() is available since, I believe XL97.

MsgBox Replace(Replace("a bc def-gh--i", " ", ""), "-", "")


Also see Help about the Replace method of the WorksheetFunction or Range
objects.

Application.WorksheetFunction.Replace(...)
Range("A1").Replace(...)

--
Bob Kilmer

"Andrea" wrote in message
m...
Is there anyway to take the value in a cell and remove any spaces or
dashes "-"?

I'm needing to find data in it's simplest form and when operators
enter values, they are often inserting inadvertant spaces or in some
cases, dashes. Is there a macro or even an excel formula that will
remove any spaces or dashes?

Any suggestions would be greatly appreciated! Thanks!