Formatting Result of Custom Function

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
 
B

Bob Phillips

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top