Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Special Characters

Is there a function in excel that removes special characters (ie: # \ @) from
a cell? Would appreciate prompt reply.

Thanks,

--
sandyboy
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Special Characters

Hi,

One way. Assumes the cells you want to remove these characters from are in
column A but change to suit. This will extract the characters that are in
cell J1 on the active sheet. The pattern provided extracts upper/lower case
letters, numbers and full stop. To add a character use the syntax |[?] to
extract the question mark.

Sub removespecial()
Dim RegExp As Object, Collection As Object, RegMatch As Object
Dim Myrange As Range, C As Range, Outstring As String
Set RegExp = CreateObject("vbscript.RegExp")
With RegExp
.Global = True
.Pattern = Cells(1, 10).Value 'J1 on active sheet [A-Z]|\d|[a-z]|[.]
End With
Set Myrange = ActiveSheet.Range("a1:a10") 'change to suit
For Each C In Myrange
Outstring = ""
Set Collection = RegExp.Execute(C.Value)
For Each RegMatch In Collection
Outstring = Outstring & RegMatch
Next
'C.Offset(0, 1) = Outstring
C.Value = Outstring
Next

Set Collection = Nothing
Set RegExp = Nothing
Set Myrange = Nothing
End Sub


Mike

"sandyboy" wrote:

Is there a function in excel that removes special characters (ie: # \ @) from
a cell? Would appreciate prompt reply.

Thanks,

--
sandyboy

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default Special Characters

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"#",""),"\"," "),"@","")


"sandyboy" wrote:

Is there a function in excel that removes special characters (ie: # \ @) from
a cell? Would appreciate prompt reply.

Thanks,

--
sandyboy

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
Special Characters aftamath Excel Discussion (Misc queries) 1 October 18th 05 11:02 PM
Special characters Matthew S Excel Discussion (Misc queries) 10 September 24th 05 12:36 AM
special characters (little box) YuChieh Excel Discussion (Misc queries) 9 June 14th 05 01:41 PM
special characters tjh Excel Worksheet Functions 3 May 13th 05 10:50 PM
Special characters Gilles Desjardins Excel Worksheet Functions 2 December 8th 04 04:17 AM


All times are GMT +1. The time now is 02:13 PM.

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"