ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Case sensitive data (https://www.excelbanter.com/excel-programming/280928-case-sensitive-data.html)

Ian[_9_]

Case sensitive data
 
I am trying to perform a routine based on the value of a
cell. The value is case sensitive and I need it to
distinguish between "GBP" & "GBp" - Can these text strings
be distinguished in VBA?

Rgds

Chip Pearson

Case sensitive data
 
Ian,

Use the StrComp function. This allows you to specify case-insensitive
comparisons.

If StrComp("GBP", "GBp", vbBinaryCompare) = 0 Then
Debug.Print "equal strings"
Else
Debug.Print "not equal strings"
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Ian" wrote in message
...
I am trying to perform a routine based on the value of a
cell. The value is case sensitive and I need it to
distinguish between "GBP" & "GBp" - Can these text strings
be distinguished in VBA?

Rgds




Chip Pearson

Case sensitive data
 
This allows you to specify case-insensitive

Of course, that should be 'case-sensitive'.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Chip Pearson" wrote in message
...
Ian,

Use the StrComp function. This allows you to specify case-insensitive
comparisons.

If StrComp("GBP", "GBp", vbBinaryCompare) = 0 Then
Debug.Print "equal strings"
Else
Debug.Print "not equal strings"
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Ian" wrote in message
...
I am trying to perform a routine based on the value of a
cell. The value is case sensitive and I need it to
distinguish between "GBP" & "GBp" - Can these text strings
be distinguished in VBA?

Rgds






[email protected]

Case sensitive data
 
See the 'StrComp' function in VBE help. It allows for binary (case
sensitive) and textual comparisons.

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

I am trying to perform a routine based on the value of a
cell. The value is case sensitive and I need it to
distinguish between "GBP" & "GBp" - Can these text strings
be distinguished in VBA?

Rgds




All times are GMT +1. The time now is 10:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com