![]() |
VB String Comparison In Excel
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 |
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 |
All times are GMT +1. The time now is 05:54 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com