• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

How to get the € symbol with VBA|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / How to get the € symbol with VBA|VBA & Macros|Excel Forum|My Online Training Hub

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosHow to get the € symbol with VBA
sp_PrintTopic sp_TopicIcon
How to get the € symbol with VBA
Avatar
A.Maurizio
Member
Members
Level 0
Forum Posts: 202
Member Since:
June 26, 2016
sp_UserOfflineSmall Offline
1
December 6, 2022 - 2:59 am
sp_Permalink sp_Print

Hello everyone, my name is A.Maurizio

I have a question to ask you about my problem with the use of VBA

My question is this:
I would like to know how to get the Euro Symbol using its code

I'll explain :
On Form 1 I have inserted two labels and a Button I have Button that it is

Then in the First Label I insert the Ascii code - "128"

While Inside the Button I reported this code:

Private Sub Button26_Click(sender As Object, e As EventArgs) Handles Button26.Click

Dim CodeInt As Integer

CodeInt = Me.Label1.Text & Char("128")

Me.Label2.Text = CodeInt & Asc("")

End Sub

But I can't get anything
Therefore I ask you for a hand to solve this problem. Thank you
I look forward to your clarifications on this
Greetings from A.Maurizio

sp_AnswersTopicSeeAnswer See Answer
Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1463
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
December 6, 2022 - 10:03 am
sp_Permalink sp_Print

Hi Maurizio,

I'm not clear on what it is you are trying to do.  There's no code in your file and the code as posted does not work.

To get the text from a label you can use

Me.Label1.Caption

and the function is CHR not Char 

 

To print the Euro symbol you can use this

Range("A1").Value = Chr(128)

 

Hope that is what you are after.

Regards

Phil

sp_AnswersTopicAnswer
Answers Post
Avatar
Velouria
London or thereabouts
Member
Members


Trusted Members
Level 4
Forum Posts: 574
Member Since:
November 1, 2018
sp_UserOfflineSmall Offline
3
December 6, 2022 - 7:19 pm
sp_Permalink sp_Print

Private Sub Button26_Click(sender As Object, e As EventArgs) Handles Button26.Click

 

That is VB.Net code by the way, not VBA.

Avatar
A.Maurizio
Member
Members
Level 0
Forum Posts: 202
Member Since:
June 26, 2016
sp_UserOfflineSmall Offline
4
December 6, 2022 - 10:34 pm
sp_Permalink sp_Print

Hello Velouria and
Avatar
Philip Treacy thank you both for your support .in fact I had also made a little bit of confusion in reporting the listing because: I was working on two fronts both using the vba and I vstudio 2022 .

But it is also true that last night while waiting for your clarification on the subject, I then managed to solve everything myself; Then using Philip Treacy's routine.

UserForm1.TextBox2.Text = Note_Denomination & Chr(128)

That's it - Now it's up to me! To then use an if then to implement everything automatically using the ASC code - Thanks for everything Sincere greeting to all from A.Maurizio

Avatar
A.Maurizio
Member
Members
Level 0
Forum Posts: 202
Member Since:
June 26, 2016
sp_UserOfflineSmall Offline
5
December 8, 2022 - 1:53 am
sp_Permalink sp_Print sp_EditHistory

Hello everybody
I just thought I learned them all; But apparently not so!
Therefore I ask you again for a little help in explaining this to me:
If I write "CHR("128") the desired euro symbol "€" appears and so far everything is ok

But if I wanted to extract the symbol of the Square Root which is composed of this code:
Alt + 251 Alt + 8730 Ascii how should I write even just using a simple msgbox.

that's all ! Thank you
Greetings from A.Maurizio

Avatar
A.Maurizio
Member
Members
Level 0
Forum Posts: 202
Member Since:
June 26, 2016
sp_UserOfflineSmall Offline
6
December 8, 2022 - 2:49 am
sp_Permalink sp_Print

Hello everybody
Please disregard my last request any longer; As I solved this problem myself
Which was easier than expected
And for fairness I send you the entire list
Including base image that it gets once it launches the form
For the rest what to say!
Thanks for everything Greetings and good work to all from A.Maurizio

 

Private Sub CommandButton1_Click() Dim wsc As Integer Dim MyControl As Control Dim x As Integer Dim label As Integer 'wsc = Sheets.Count Dim tot As Integer 'Conto Il Numero Delle Label INSERITE Nella Userform For Each MyControl In Controls If (MyControl.Name Like "Label*") Then tot = tot + 1 End If Next MyControl 'Imposto Le Label Senza Test For label = 1 To 9 Me.Controls("Label" & label) = label Me.Label10.Caption = "0" Me.Label11.Caption = VBA.Chr("46") Me.Label12.Caption = VBA.Chr("37") Me.Label13.Caption = VBA.Chr("128") Me.Label14.Caption = VBA.Chr("94") Me.Label15.Caption = VBA.Chr("163") Me.Label16.Caption = ChrW(8730) Me.Label17.Caption = "Apri" Me.Label18.Caption = "Salva" Me.Label19.Caption = "Memo" Me.Label20.Caption = "Back" Me.Label21.Caption = VBA.Chr("43") Me.Label22.Caption = VBA.Chr("45") Me.Label23.Caption = VBA.Chr("42") Me.Label24.Caption = VBA.Chr("47") Me.Label25.Caption = VBA.Chr("61") Next label End Sub

 

Image Enlarger

 Image Enlarger

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1463
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
7
December 8, 2022 - 9:33 am
sp_Permalink sp_Print

Hi Maurizio,

glad you got it figured out.

Regards

Phil

Avatar
Velouria
London or thereabouts
Member
Members


Trusted Members
Level 4
Forum Posts: 574
Member Since:
November 1, 2018
sp_UserOfflineSmall Offline
8
December 8, 2022 - 7:10 pm
sp_Permalink sp_Print

Not a big deal but just so you know: Chr (like ChrW) expects a number, not a string, so by passing strings you're actually making it do unnecessary work coercing the text to a number value.

The following users say thank you to Velouria for this useful post:

Philip Treacy
Avatar
A.Maurizio
Member
Members
Level 0
Forum Posts: 202
Member Since:
June 26, 2016
sp_UserOfflineSmall Offline
9
December 11, 2022 - 1:54 am
sp_Permalink sp_Print

Hi Velouria
Sorry for writing you just now, but I've been busy with my work.
Having said that : I don't understand when you say that writing ( CHR() or CHRW() ) is the same thing because they give the same result.

But since it works I don't see why not to use them!

Also because if you just wanted to write get the symbol
( 8730 ) which corresponds to the symbol of ( Quadeate Root )
If you don't call it using (CHRW) you can't stray.
That's all
However, I renew my most sincere greetings

Avatar
Velouria
London or thereabouts
Member
Members


Trusted Members
Level 4
Forum Posts: 574
Member Since:
November 1, 2018
sp_UserOfflineSmall Offline
10
December 12, 2022 - 4:28 am
sp_Permalink sp_Print

I didn’t say that Chr and ChrW are the same. I said that both expect a number to be passed to them, not a string. 

Avatar
A.Maurizio
Member
Members
Level 0
Forum Posts: 202
Member Since:
June 26, 2016
sp_UserOfflineSmall Offline
11
December 12, 2022 - 8:26 pm
sp_Permalink sp_Print

Hi Velouria
Yes you are right, but I wrote what I wrote
Because since I didn't have my pc at hand, I didn't remember exactly what you said.
But I go back to reiterating that now everything works wonders for me also thanks to your support; And I'm fine with that!
The important thing was to understand how the Ascii code worked, both as regards the CHR() and the CHRW() compared to the ASC()
Which served my purpose.
Now, if anything, my problem is another: that going from VBA to Visual Studio, everything doesn't work for me anymore.
But this is a whole other story.
Heartfelt thanks for your patience, therefore I renew my most sincere greetings and good work to all from A.Maurizio

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 170
Currently Online:
Guest(s) 32
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1431
Anders Sehlstedt: 848
Velouria: 574
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 213
A.Maurizio: 202
Aye Mu: 201
Jessica Stewart: 185
Newest Members:
David Collins
Andras Marsi
Orimoloye Funsho
YUSUF IMAM KAGARA
PRADEEP PRADHAN
Vicky Otosnika
Abhishek Singh
Kevin Sojourner
Kara Weiss
And Woox
Forum Stats:
Groups: 3
Forums: 24
Topics: 6047
Posts: 26543

 

Member Stats:
Guest Posters: 49
Members: 31497
Moderators: 2
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Riny van Eekelen
© Simple:Press —sp_Information
  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
 
  • About My Online Training Hub
  • Contact
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Copyright © 2023 · My Online Training Hub · All Rights Reserved

Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.

Download A Free Copy of 100 Excel Tips & Tricks

excel tips and tricks ebook

We respect your privacy. We won’t spam you.

x