Formatting Result of Custom Function

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

We are trying to format the result of a custom function. Is this possible.
The code below does not do this. Here we are trying to format the letters
"cde" in the "test" function below using Macro1

Function test() As String
Application.Volatile
test = "abcdefgh"
End Function

Sub Macro1()
On Error GoTo iErrors
With ActiveCell.Characters(Start:=3, Length:=3).Font
.Name = "Calibri"
.FontStyle = "Regular"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -16776961
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With

Exit Sub

iErrors:
Err.Clear

End Sub


Thanks in advance
 
You can't do that in a UDF, you have to do it in Excel itself.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Back
Top