PC Review


Reply
Thread Tools Rate Thread

Displaying the infinity symbol in an excel spreadsheet

 
 
Bob
Guest
Posts: n/a
 
      6th Sep 2008
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


 
Reply With Quote
 
 
 
 
Doug Glancy
Guest
Posts: n/a
 
      6th Sep 2008
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
>
>



 
Reply With Quote
 
FSt1
Guest
Posts: n/a
 
      6th Sep 2008
hi
code worked for me in 2003. not sure why it don't work for you.
you do realize the author of the code is putting 2 fonts in the cell.
Arial for the words. and symbols for the infinity sign.
Chr(165) in arial is the yen sign or ¥ but formated to symbols it becomes
the infinity sign. not sure if that is your problems or not. shouldn't be
i shorted the code. if you just want the infinity sign only, use this......

Range("A2").Font.Name = "Symbol"
Range("A2").Value = Chr(165)

another way......cheap and dirty.... enter the number eight and set the
orientation to 90 degrees........

Range("A3").Value = 8
Range("A3").Orientation = 90

while this "Looks" ok on the sheet but it can cause problems.

on the keyboard, you can produce the infinity sign with Alt+236 on th keypad.

regards
FSt1

"Bob" wrote:

> 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
>
>
>

 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      6th Sep 2008
Your code works fine for me in xl2003. Try the following for two different
ways

Sub test2()
Dim w As String
Range("A1:A2").Font.Name = "Arial"

w = "This is the infinity symbol: "

' mixed font
With Range("A1")
.Value = w & Chr$(165)
.Characters(Len(.Value), 1).Font.Name = "Symbol"
End With

' all Arial font
Range("A2") = w & ChrW$(8734)

End Sub

Regards,
Peter T


"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
>
>



 
Reply With Quote
 
Bob
Guest
Posts: n/a
 
      7th Sep 2008
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
>>
>>

>
>



 
Reply With Quote
 
Rookie 1st class
Guest
Posts: n/a
 
      7th Sep 2008
I don't use symbols. Hold down the [Alt] key, on the number pad type 236,
release the [Alt] key. TADA. It works for me regardfless of the font selected.

"Peter T" wrote:

> Your code works fine for me in xl2003. Try the following for two different
> ways
>
> Sub test2()
> Dim w As String
> Range("A1:A2").Font.Name = "Arial"
>
> w = "This is the infinity symbol: "
>
> ' mixed font
> With Range("A1")
> .Value = w & Chr$(165)
> .Characters(Len(.Value), 1).Font.Name = "Symbol"
> End With
>
> ' all Arial font
> Range("A2") = w & ChrW$(8734)
>
> End Sub
>
> Regards,
> Peter T
>
>
> "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
> >
> >

>
>
>

 
Reply With Quote
 
Bob
Guest
Posts: n/a
 
      7th Sep 2008
How do you do the same thing with code in VBA as a function (not a sub)?

Bob

"Rookie 1st class" <Rookie1stClass@SpamThis> wrote in message
news:793592A0-00CB-4988-ABA9-(E-Mail Removed)...
>I don't use symbols. Hold down the [Alt] key, on the number pad type 236,
> release the [Alt] key. TADA. It works for me regardfless of the font
> selected.
>
> "Peter T" wrote:
>
>> Your code works fine for me in xl2003. Try the following for two
>> different
>> ways
>>
>> Sub test2()
>> Dim w As String
>> Range("A1:A2").Font.Name = "Arial"
>>
>> w = "This is the infinity symbol: "
>>
>> ' mixed font
>> With Range("A1")
>> .Value = w & Chr$(165)
>> .Characters(Len(.Value), 1).Font.Name = "Symbol"
>> End With
>>
>> ' all Arial font
>> Range("A2") = w & ChrW$(8734)
>>
>> End Sub
>>
>> Regards,
>> Peter T
>>
>>
>> "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
>> >
>> >

>>
>>
>>



 
Reply With Quote
 
Doug Glancy
Guest
Posts: n/a
 
      7th Sep 2008
Bob,

You generally can't change a cell in a function. So all the formatting you
do in the sub is not available. And I can't figure out how to insert the
infinity symbol into a VBA string, which could then be returned by the
function.

Doug

"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
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      7th Sep 2008
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
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Bob
Guest
Posts: n/a
 
      7th Sep 2008
Thanks Peter. It works great. I did not even see the second portion of
your previous post. Sorry about that. Have a great weekend.

Bob


"Peter T" <peter_t@discussions> wrote in message
news:(E-Mail Removed)...
> 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
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to insert infinity symbol in excel? Zhead Microsoft Excel Worksheet Functions 3 14th Nov 2010 09:41 PM
infinity symbol ... conflict of information? Dave Horne Microsoft Word New Users 2 7th Mar 2008 03:05 PM
Re: Infinity symbol Suzanne S. Barnhill Microsoft Word Document Management 0 17th Jan 2007 03:44 PM
I can't get an 'infinity' symbol. used in calculus (integration) =?Utf-8?B?U2F5YW50YW4gQ2hha3JhYm9ydHksIEVsZWN0cmlj Microsoft Word Document Management 2 30th Apr 2006 03:01 AM
Where's the infinity symbol? What font? =?Utf-8?B?VGhlIE1hdGggTWFuPw==?= Microsoft Word Document Management 1 5th Dec 2005 09:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:26 AM.