Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default removing unwanted characters in a cell

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
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!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default removing unwanted characters in a cell

Highlight the cells in question; then at the toolbar, Edit, Replace
Round 1: Enter in replace what "-" without the quote marks
In next box - with what? Leave blank - enter nothing
Select replace all
with same area highlighted
Round2" Enter in the replace what Enter a single space (using your
space bar)
In the next box - with what? Leave Blank - enter
nothing
Select replace all

Re-format every thing
Back up your files before trying this..............

HTH

"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!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default removing unwanted characters in a cell

Replace() was introduced with VBA6 in XL00. For XL97 and MacXL
versions, use

With Application
.Substitute(.Substitute("a bc def-gh--i", " ", ""), "-", "")
End With

instead.

In article ,
"Bob Kilmer" wrote:

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

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing extra characters in a cell Sherry Excel Discussion (Misc queries) 3 January 18th 08 09:19 PM
Removing unwanted characters Richard Excel Discussion (Misc queries) 2 June 23rd 06 07:34 PM
Removing unwanted characters jermsalerms Excel Discussion (Misc queries) 15 January 19th 06 09:20 PM
Removing unwanted characters Scorpvin Excel Discussion (Misc queries) 8 December 5th 05 09:07 PM
removing some of the characters from a cell Patience Excel Discussion (Misc queries) 2 May 3rd 05 08:28 PM


All times are GMT +1. The time now is 01:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"