-
May 18th, 2016, 01:48 PM
#1
Thread Starter
New Member
VBA for Excel 2013: Instr produces incorrect result
dim a
a="CREATE MENU [Staging].[OAs] AS"
?instr(a,"AS"), len(a)
29
a=lcase("CREATE MENU [Staging].[OAs] AS")
?instr(a,"as")
25
a=ucase("CREATE MENU [Staging].[OAs] AS")
?instr(a,"AS")
25
Why the difference when using ucase or lcase, missing the correct position by exactly 4 characters? Anyone?
Nico
-
May 18th, 2016, 01:52 PM
#2
Thread Starter
New Member
Re: VBA for Excel 2013: Instr produces incorrect result
Sorry, the third line should not have ", len(a)"
It reported 30, anyway.
-
May 18th, 2016, 03:01 PM
#3
Re: VBA for Excel 2013: Instr produces incorrect result
Because ucase converts the [OAs] to [OAS], and the "AS" in the brackets starts in position 25.
-
May 20th, 2016, 11:34 AM
#4
Thread Starter
New Member
Re: VBA for Excel 2013: Instr produces incorrect result
Originally Posted by vbfbryce
Because ucase converts the [OAs] to [OAS], and the "AS" in the brackets starts in position 25.
Funny how one's mind is made up beforehand what to expect. Especially when it's late and one is tired.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|