I am importing data and can't even begin to nail own all of the codes for the various characters. I want to keep a-z and 0-9 and "-" but, everything else must go.
Also, this is for an excel macro.
Thanks all.
I am importing data and can't even begin to nail own all of the codes for the various characters. I want to keep a-z and 0-9 and "-" but, everything else must go.
Also, this is for an excel macro.
Thanks all.
Easy enough but a little more detail is needed.
1)Where is the data - need a range and explain if it's variable
2) What about spaces? and A-Z
Regards
Tom
If my answer resolves your issue, please mark your Thread as SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
Try this code to see if this works as per your requirement.
Assuming your data is in col. A
Please Login or Register to view this content.
Regards
sktneer
Treat people the way you want to be treated. Talk to people the way you want to be talked to.
Respect is earned NOT given.
try
Please Login or Register to view this content.
You are including comma.If str Like "[A-Z,a-z,0-9,-]" Then
If there are multiple duplicate "bad" values then I think this algorithm will run a little faster as it replaces all the duplicate bad values at once?
Regards,Please Login or Register to view this content.
jindon,
That is some nice code, can you explain how the replace function does all the bad characters without looping? Obviously much faster than my solution.
Thanks,
Edit: Disregard, I did some web searching on VBScript RegExp Object and understand it now.
Last edited by tom.hogan; 05-14-2014 at 05:15 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks