ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Symbol in VBA (https://www.excelbanter.com/excel-programming/404703-insert-symbol-vba.html)

Gary''s Student

Insert Symbol in VBA
 
Can I insert a symbol in VBA just as I can in the worksheet with:

Insert Symbol...

I would like to enter code like:

Sub symenterx()
ActiveCell.Value = "ˆ°"
End Sub

rather than:

Sub symenter()
ActiveCell.Value = ChrW(8752)
End Sub


--
Gary''s Student - gsnu200765

FSt1

Insert Symbol in VBA
 
hi
Activecell.value = chr(2)
look up "Character set" in vb help for a list.

regards
FSt1

"Gary''s Student" wrote:

Can I insert a symbol in VBA just as I can in the worksheet with:

Insert Symbol...

I would like to enter code like:

Sub symenterx()
ActiveCell.Value = "ˆ°"
End Sub

rather than:

Sub symenter()
ActiveCell.Value = ChrW(8752)
End Sub


--
Gary''s Student - gsnu200765


Bernard Liengme

Insert Symbol in VBA
 
Yes. I used

Sub symenterx()
ActiveCell.Value = "£"
End Sub

I entered the UK pound sign with ALT+0163 (on number pad)
Not sure what code give your symbol
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Gary''s Student" wrote in message
...
Can I insert a symbol in VBA just as I can in the worksheet with:

Insert Symbol...

I would like to enter code like:

Sub symenterx()
ActiveCell.Value = "?"
End Sub

rather than:

Sub symenter()
ActiveCell.Value = ChrW(8752)
End Sub


--
Gary''s Student - gsnu200765




Gary''s Student

Insert Symbol in VBA
 
Thank you. Using ALT+0163 enters pound symbol in both the worksheet and in
VBA. I tried ALT+3333 in the worksheet and got the Club symbol from a deck
of cards. This did not work in VBA.

I guess the ALT+ method can only be used for a subset of symbols in VBA
--
Gary''s Student - gsnu200765


"Bernard Liengme" wrote:

Yes. I used

Sub symenterx()
ActiveCell.Value = "£"
End Sub

I entered the UK pound sign with ALT+0163 (on number pad)
Not sure what code give your symbol
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Gary''s Student" wrote in message
...
Can I insert a symbol in VBA just as I can in the worksheet with:

Insert Symbol...

I would like to enter code like:

Sub symenterx()
ActiveCell.Value = "?"
End Sub

rather than:

Sub symenter()
ActiveCell.Value = ChrW(8752)
End Sub


--
Gary''s Student - gsnu200765






All times are GMT +1. The time now is 05:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com