C
Carin
I need to format cells in Excel so it automatically converts text to all CAPS
when a user enters in data.
when a user enters in data.
Gord Dibben said:Just a caveat with Rick's code.
If you have any formulas in the B3:E10 range they will be converted to
values.
To prevent that.
Sub UpperCaseExistingText()
Dim R As Range
On Error GoTo Whoops
Application.EnableEvents = False
For Each R In Range("B3:E10")
R.Formula = UCase$(R.Formula)
Next
Whoops:
Application.EnableEvents = True
End Sub
Gord Dibben MS Excel MVP
Uh, his code is nice, but it doesn't address (meaning it has the same flaw)
as I was attempting to point out... it upper cases **everything** in the
formula including text strings used to check text from outside the range,
even if doing so destroys the formula's intent. Using the same formula I
posted in my last message...
=IF(ISNUMBER(FIND("rick",$A$1)),"Yes","No")
Because FIND is being used, the contents of A1 is being searched in a
case-sensitive manner; hence, "rick" needs to stay "rick" in order for the
function to do what it was designed to do. However, David's code and my
code, changed in accordance with the caveat you posted, both change the
"rick" to "RICK"... that means FIND will no longer be able to find what it
was intended to find and the formula, while still a formula, will no longer
perform as intended.
Rick