As Doug has explained a UDF cannot change the interface, which includes
reformatting font name.
Curiosity, why didn't you try the second example I posted which does not
require reformat of the font and so will work fine in a UDF (subject to the
existing font being a "typical" font)
Regards,
Peter T
"Bob" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks Doug. I am not using a sub, but a function, that I call from
> inside the spreadsheet. I call the function from cell A1. I know a sub
> works fine.
>
> Bob
>
> "Doug Glancy" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Bob,
>>
>> You don't say what error you get. It works for me. I did change the
>> code slightly, to declare your variables:
>>
>> Sub test()
>> Dim w As String
>> Dim x As Long
>>
>> With Range("A1")
>> .Font.Name = "Arial"
>> w = "This is the infinity symbol: " & Chr(165)
>> .Value = w
>> x = Len(Range("A1").Value)
>> .Characters(Start:=x, Length:=1).Font.Name = "Symbol"
>> End With
>> End Sub
>>
>> hth,
>>
>> Doug
>>
>> "Bob" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> Hi Everyone:
>>>
>>> I posted a similar message on the VB newsgroup, and got my answer for
>>> VB. Now, I was wondering does anyone know how to display the infinity
>>> symbol in the excel spreadsheet using VBA? I tried this code, but it did
>>> not work on excel 2003.
>>>
>>> Range("A1").Font.Name = "Arial"
>>> w = "This is the infinity symbol: " & Chr(165)
>>> Range("A1").Value = w
>>> x = Len(Range("A1").Value)
>>> Range("A1").Characters(Start:=x, Length:=1).Font.Name = "Symbol"
>>>
>>> Thanks for your help.
>>>
>>> Bob
>>>
>>>
>>
>>
>
>
|