Cannot use GBP (Β£) symbol in VBA

I have an English version of Excel and Polish regional settings. I am trying to make a code that will format cells with a pound symbol to a number.

Unfortunately, it converts to "L" when I insert a character into a VBA window. The macro recorder also records cells formatted in such a way as β€œL”. Chr (163) returns "Ł".

Changing the system language settings, localization settings, or keyboard settings did not affect. Only after changing the regional settings (requires a reboot of the PC) to English (UK) does it work correctly. Can I use this symbol without changing the regional settings?

+7
vba excel-vba excel
source share
1 answer

If you want to apply a character to formatting through VBA, try:

Sub Serling() Const g = "General" dq = Chr(34) sterl = " " & ChrW(163) s = g & dq & sterl & dq Selection.NumberFormat = s Selection.Font.Name = "Arial Unicode MS" End Sub 

enter image description here

EDIT # 1:

This is really cool for me. If you want degrees Celsius, use ChrW (8451): if you want degrees Fahrenheit, use ChrW (8457), etc.

+5
source share

All Articles