JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,687
- Office Version
- 365
- Platform
- Windows
I got some great help recently in learning how to return extended Unicode characters such as the up and down arrows from a UDF. Now I need to learn how to test for those same codes when read from the worksheet by a different UDF.
Here's my code. The 4 statements after the comments are trying to compare the character from the cell to the global Unicode constant, gMaxCode.
The character is stored in the cell using this code from a different UDF:
Here's my code. The 4 statements after the comments are trying to compare the character from the cell to the global Unicode constant, gMaxCode.
Code:
Public Const gMaxCode As Long = &H2191 'Up arrow
Public Function PCTally(pAMRange As Range) as String
Dim OU As String 'The code character in the cell
NumReadings = pAMRange.Rows.Count
For i = 2 To NumReadings - 1
OU = Left(pAMRange(i).Text, 1) 'Get code character
'None of these tests works
If OU = gMaxCode Then AMHi = AMHi + 1
If ChrW(OU) = gMaxCode Then AMHi = AMHi + 1
If OU = ChrW(gMaxCode) Then AMHi = AMHi + 1
If OU = CLng(gMaxCode) Then AMHi = AMHi + 1
Next i
Code:
OverUnder = ChrW(gMaxCode) & Round(pReading - pGood, 0)