Banner

Thursday, May 7, 2020

How to insert Currency Symbols In Userform Excel VBA

How to insert Currency Symbols In Userform Excel VBA



In this Blog I showing how to insert currency symbols
in Listbox using VBA code By Change combobox
U can choose different currency symbols from combobox dropdown menu


How to insert Currency Symbols In Userform Excel VBA

                                                                 Watch Video

Currency Symbols

Code for Symbols This Code Not Used In Tutorial Video)
Example
'Sheet1.range("A1")=ChrW$(&H20B9&)   '(Indian Currency)
Ucan get Currency Symbol Code
Excel Tab Menu   Insert   Symbols
See Photo
How to insert Currency Symbols In Userform Excel VBA


USA                                  $
Indian rupee                                  ₹
UAE                                  د.إ
Pound                                  £
Rupee                                  ₨
Euro Currency                                  €
Yen                                  ¥
French                                  ₣
Morocco                                  .د.م
Afghanistan                                  Af
Iraq                                  ع.د
Iran                                  ﷼
Oman                                  ر.ع.
Bangladesh                                  ৳
Bahrain                                  ب.د
North Korea                                  ₩
Qatar                                  ر.ق
Thailand                                  ฿
Saudi Arabia                                  ر.س

Tutorial VBA Code

For Userform Combobx Fill Data from Sheet2
Private Sub UserForm_Initialize()
'Combobox fill From Sheet2
Dim i As Long
For i = 2 To Sheet2.Range("A1000000").End(xlUp).Row
Me.ComboBox1.AddItem Sheet2.Cells(i, "A")
Me.ComboBox1.List(Me.ComboBox1.ListCount - 1, 1) = Sheet2.Cells(i, "B")
Next i
End Sub

For Listbox fill Data from Sheet2 with Currency Symnols
Private Sub CommandButton1_Click()
Dim A  As String
Dim i As Long
Me.ListBox1.Clear
If Me.ComboBox1 <> "" Then
A = Me.ComboBox1.List(Me.ComboBox1.ListIndex, 1)
For i = 2 To Sheet2.Range("D1000000").End(xlUp).Row
Me.ListBox1.AddItem Sheet2.Cells(i, "D")
Me.ListBox1.List(ListBox1.ListCount - 1, 1) = A & " " & Sheet2.Cells(i, "E")
Next i

Dim sum As Double
Dim x As Integer
Dim C, D As String
For x = 0 To Me.ListBox1.ListCount - 1
C = Len(Me.ListBox1.List(x, 1))
D = Len(A)
sum = sum + Val(Right(Me.ListBox1.List(x, 1), C - D))
Next x
 Me.ListBox1.AddItem
 Me.ListBox1.AddItem "Total"
 Me.ListBox1.List(ListBox1.ListCount - 1, 1) = A & " " & Format(sum, "#####.00")

 End If
End Sub





No comments:

Post a Comment

Please do not enter any spam message in comment box