John Carney
asked on
Formatting last 5 characters of a cell
This macro bugs on the last line:
Thanks,
John
If InStr(UCase(cel), "MAINT") > 0 Or InStr(UCase(cel), "DKFL") > 0 Then
cel.Characters(Start:=x, Length:=y).Font.FontStyle = "Bold"
cel.Characters(Start:=x, Length:=y).Font.Size = 14
cel.Characters(Start:=x, Length:=y) = UCase(cel.Characters(Start:=x, Length:=y))
End If
What baffles me is that this line works:
cel.Characters(Start:=x, Length:=y).delete
but this line doesn't:
cel.Characters(Start:=x, Length:=y) =ucase(cel.Characters(Start:=x, Length:=y))
How should I write that line?Thanks,
John
When you say the "macro bugs" what error do you get?
ASKER
"Object doesn't support this property or method."
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Perfect, thanks!
Does this work?I just tested your solution and it does work. I didn't even know a cell had a Caption property:(
cel.Characters(Start:=x, Length:=y).Caption = UCase(cel.Characters(Start:=x, Length:=y).Caption)
In any case I don't expect any points for this but this also works and to me it's more "normal".
cel.Characters(Start:=x, Length:=y).Text = UCase(cel.Characters(Start