Help me adjust this code to suit my need

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
1,767
Office Version
2016
Platform
Windows
I came across this code while searching the from the net . I need some explanation to what is happening so I can modify it to suit my needs. Why the number 809? Should that number be used for all other symbols ? Please help
Code:
[COLOR=#000000][FONT=Courier]With Me.MBStake[/FONT][/COLOR][COLOR=#000000][FONT=Courier].Text = Application.Text(Range("MBStake").Value, "[$£-809]#,##0.00;-[$£-809]#,##0.00")[/FONT][/COLOR][COLOR=#000000][FONT=Courier] 
   If Range("MBStake").Value < 0 Then[/FONT][/COLOR][COLOR=#000000][FONT=Courier] 
       .ForeColor = vbRed[/FONT][/COLOR][COLOR=#000000][FONT=Courier] 
   Else[/FONT][/COLOR][COLOR=#000000][FONT=Courier] 
       .ForeColor = vbBlack[/FONT][/COLOR][COLOR=#000000][FONT=Courier] 
   End If[/FONT][/COLOR][COLOR=#000000][FONT=Courier]End With
[/FONT][/COLOR]
 

Some videos you may like

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

wideboydixon

Well-known Member
Joined
Jun 2, 2016
Messages
3,401
The 809 is a hexadecimal value. Decoding to decimal gives 2057 which is the LCID (Locale ID) for Great Britain. So the "[$£-809]" part reads as "prefix with the Great Britain £ symbol". If you wanted to force US$ then you could use [$$-409] for example.

Hope that helps.

WBD
 

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
1,767
Office Version
2016
Platform
Windows
Okay great. I am in ghana how do I get the Cedis symbol?

Or if not possible then how will I omit the symbol all together?
Thanks
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,434
Messages
5,511,327
Members
408,842
Latest member
Amuserad

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top