View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Office_Novice Office_Novice is offline
external usenet poster
 
Posts: 245
Default Detect UPPERCASE in cell value?

Option Explicit
Sub Do_Uppercase()
Dim UpperCase

UpperCase = UCase(ActiveCell.Value)
If ActiveCell.Value = UpperCase Then
MsgBox "Ding", vbOKOnly
ElseIf ActiveCell.Value < UpperCase Then
MsgBox "Nope", vbCritical
End If
End Sub


" wrote:

Fellow programmers... below is some code I tried to create to detect
if the contents of the ActiveCell.Value was all UPPERCASE. The
spreadsheet is importing data and if a cell's value is all updercase
it means something specific with the data that being imported. Any
ideas as to how to make a TRUE & FALSE statement based on the
characters being all uppdercase?

Declare Function IsCharUpper Lib "user32" Alias "IsCharUpperA" _
(ByVal cChar As Byte) As Long
Sub Button22221_Click()

If IsCharUpper(ActiveCell.Value) = True Then
MsgBox "It is bitch.", vbOKOnly, "-Test-"
End If

If IsCharUpper(ActiveCell.Value) = False Then
MsgBox "It's not uppercase.", vbOKOnly, "-Test 2-"
End If

End Sub


Thanks in advance!