Upper Case Macro
If Not r.HasFormula Then
r.Value = UCase(r.Value)
else
r.formula = "=UPPER(" & right(r.formula,len(r.formula)-1) & ")"
end if
maybe
"Sam Wilson" wrote:
True, but imagine
A1 = "BlahBlahBlah"
B1 = "=A1"
If you use ucase(Range("B1").formula) you won't end up with BLAHBLAHBLAH
Sam
"Mike H" wrote:
Sam,
Using .value is taking an unnecessary risk. What it will do is change any
formula selected (maybe by accident) to values. Use .formula instead or check
using something like
If Not r.HasFormula Then r.Value = UCase(r.Value)
Mike
"Sam Wilson" wrote:
Sub upper()
Dim r As Range
For Each r In Selection
r.Value = UCase(r.Value)
Next r
End Sub
"Phil H" wrote:
I need a macro, which will be attached to a button, to change text to upper
case for any range of selected cells. Can someone help?
|