View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Fix If statment to accept Upper or Lower Case

Bob,

At the very top of the code module, above and outside of any
procedures, put the line

Option Compare Text


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



"rleonard" wrote in message
...
Macro will not work if input box entry is in upper case and If

statment = a item in lower case
Is there a way to fix so macro will work regardless of how

entered in input box
Thanks
Bob Leonard


Sub TestIf()

Dim varInput As String
Range("P5").Select
varInput = InputBox("Enter Value")
Selection.VALUE = varInput

If Selection.VALUE = "test_1" Then
Application.Run "test"

ElseIf Selection.VALUE = "test_2" Then
Application.Run "test2"

End If
End Sub