View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson[_2_] Chip Pearson[_2_] is offline
external usenet poster
 
Posts: 95
Default VB String Comparison In Excel

Craig,

Try something like the following:

Dim S As String
Dim ReplaceTokens As Variant
Dim Ndx As Long
ReplaceTokens = Array("P/N", "'", "\", "/", "[", "]", "(", ")", _
"*", "(ALT)", "(OLD)", "(NEW)")
S = "\abc[]def/*" '<<<< STRING TO PROCESS
For Ndx = LBound(ReplaceTokens) To UBound(ReplaceTokens)
S = Replace(S, ReplaceTokens(Ndx), "")
Next Ndx
Debug.Print S


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Craig" wrote in message
...
I want to program code in VB in Excel that eliminates
certain characters from a particular cell. The characters
a

- \ / [ ] ( ) * P/N (ALT) (OLD) (NEW)

There are some others, but these are the
characters/substrings I wish to eliminate. How would
something like that start out? If anyone has any tips,
please let me know. Thank you...

Craig