JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,532
- Office Version
- 365
- Platform
- Windows
I'm a bit puzzled by a couple of the Compare options for the Split function.
According to this link:
https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/split-function
The Compare option has these values:
<tbody>
</tbody>
I tested these Compare settings using this expression:
I got these results:
<tbody>
</tbody>
Questions:
According to this link:
https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/split-function
The Compare option has these values:
Value | Variable | Description |
-1 | vbUseCompareOption | Performs a comparison using the setting of the Option Compare statement. |
0 | vbBinaryCompare | Performs a binary comparison. Case sensitive? Default? |
1 | vbTextCompare | Performs a textual comparison. Case insensitive? |
2 | vbDatabaseCompare | Microsoft Access only. Performs a comparison based on information in your database. |
<tbody>
</tbody>
I tested these Compare settings using this expression:
Code:
A=Split("3.5ft","FT",,see table)
I got these results:
Compare Setting | UBound | A(0) | A(1) | Comments |
omitted | 0 | |3.5ft| | Case sensitive? | |
-1 | -- | -- | Invalid call | |
vbUseCompareOption | 0 | |3.5ft| | Case sensitive? | |
0 | 0 | |3.5ft| | Case sensitive? | |
vbBinaryCompare | 0 | |3.5ft| | Case sensitive? | |
1 | 1 | |3.5| | || | Case insensitive? |
vbTextCompare | 1 | |3.5| | || | Case insensitive? |
2 | 1 | |3.5| | || | Case insensitive? |
vbDatabaseCompare | 1 | |3.5| | || | Case insensitive? |
3 | 1 | |3.5| | || | Case insensitive? |
<tbody>
</tbody>
Questions:
- Which one is the default? It appears to be the binary compare (1).
- Why do I get an error when I explicitly code "-1", but not when I code vbUseCompareOption, which = -1?
- Is the binary compare case sensitive and the text compare case insensitive?
- It appears that any value > 1 works the same as 1.