Re: How do I copy first consonant from a word into new cell

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Instead of using Option Compare Text to make your Like comparison case
insensitive, you could remove it and use this Like comparison instead...

If Not sTemp Like "[AEIOUYaeiouy]" Then

and instead of using the Not keyword, I would probably have used the Like
operator's negation meta-character (which is the exclamation mark)...

If sTemp Like "[!AEIOUYaeiouy]" Then

Of course, another way to do this would be to remove the Option Compare Text
statement and use this statement to assign the values to sTemp...

sTemp = LCase(Mid(str, i, 1))

Then you can leave the rest of your code exactly as you posted it and it
will work correctly.

Yes, there are many different ways to solve this problem.

Yes, I know you knew that... I just thought the readers of this thread might find it interesting to see some of them.

Some even include the Regular Expressions you seem to
dislike -- but I posted one subsequently :-)

I don't dislike Regular Expressions (really, I don't), it is just that I feel most people posting questions here are not all that familiar with them and would be more comfortable with solutions coded using native VB functions, operators, etc. I do feel your posting Regular Expression solutions is important, though, both for those reading this thread now, and those reading the thread later on in the archives, who are familiar with them.

--
Rick (MVP - Excel)

.



Relevant Pages

  • Re: Killfiling direct reponses to Jeff Relf
    ... It's mentioned in the Modifers and Perl extensions ... sections of the Regular Expressions page in Dialog's Help. ... Copied from the Scoring/Actions Syntax page in Dialog's Help: ... Even reading the above in Xnews will produce several unwanted ...
    (news.software.readers)
  • Re: data comprised of regexs (while loop weirdness)
    ... > I assume that the contents of the file you're reading from is under ... > your control, BTW; regular expressions can contain code, so if ...
    (comp.lang.perl.misc)
  • Regular expressions performance problem
    ... I wanted to use regular expressions but unfortunetely it is too ... reading in bytes from a file then converting them to char then making a ... correct format...and take out the various paretres i need. ... method.....any alternative solutions?. ...
    (microsoft.public.dotnet.languages.csharp)
  • newbie regex question
    ... If this is the wrong forum for this question, ... I´m trying to understand regular expressions. ... I´m reading the tutorial ... TIA ...
    (alt.php)