Button to set different currencies

K

kafukalatrava

Hi all,

I'm working in a spreadsheet with different currencies.

Is there a way to create buttons to change the format of a cell to a
different currency? I'd need 3 of them (for €, $ and £ )

thx
 
B

Bernard Liengme

Begin by recording three macros: one for each currency. Here is mine for the
Euro

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 03/03/2009 by Bernard V Liengme
'
'
Range("A2").Select
Selection.NumberFormat = "[$?-2] #,##0.00"
End Sub

I edited this to become
Sub Euro()
ActiveCell.NumberFormat = "[$?-2] #,##0.00"
End Sub


Next use View | Toolbars | Forma to add three buttons to your worksheet
Assign one of your macros to each button as you make them
best wishes
 
S

Stefi

Hi Bernard,

I also tried to solve this problem, and for euro my Excel recorded
numberformat "[$€-2]# ##0,00"

Note the € sign!

In VBA
ActiveCell.NumberFormat = "["[$€-2]# ##0.00"
worked perfectly.

In your example € sign is replaced by ? (question mark). Did it produce €
sign on the worksheet?

I also recorded cell formatting to £, and it resulted in a nice £ 9999.99
format in the cell but it was recorded in the macro as "[$L-809]#,##0.00"
format code.
In VBA
ActiveCell.NumberFormat = "[$L-809]#,##0.00"

gave an ugly L 9999.99 format.

In no way I could produce £ 9999.99 format in the cell through VBA.

Do you know why? And how to overcome it?

Regards,
Stefi


„Bernard Liengme†ezt írta:
Begin by recording three macros: one for each currency. Here is mine for the
Euro

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 03/03/2009 by Bernard V Liengme
'
'
Range("A2").Select
Selection.NumberFormat = "[$?-2] #,##0.00"
End Sub

I edited this to become
Sub Euro()
ActiveCell.NumberFormat = "[$?-2] #,##0.00"
End Sub


Next use View | Toolbars | Forma to add three buttons to your worksheet
Assign one of your macros to each button as you make them
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

kafukalatrava said:
Hi all,

I'm working in a spreadsheet with different currencies.

Is there a way to create buttons to change the format of a cell to a
different currency? I'd need 3 of them (for ?, $ and £ )

thx
 
B

Bernard Liengme

Yes I got the ? sign
Maybe it depends on the font being used
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

Stefi said:
Hi Bernard,

I also tried to solve this problem, and for euro my Excel recorded
numberformat "[$?-2]# ##0,00"

Note the ? sign!

In VBA
ActiveCell.NumberFormat = "["[$?-2]# ##0.00"
worked perfectly.

In your example ? sign is replaced by ? (question mark). Did it produce ?
sign on the worksheet?

I also recorded cell formatting to £, and it resulted in a nice £ 9999.99
format in the cell but it was recorded in the macro as "[$L-809]#,##0.00"
format code.
In VBA
ActiveCell.NumberFormat = "[$L-809]#,##0.00"

gave an ugly L 9999.99 format.

In no way I could produce £ 9999.99 format in the cell through VBA.

Do you know why? And how to overcome it?

Regards,
Stefi


"Bernard Liengme" ezt írta:
Begin by recording three macros: one for each currency. Here is mine for
the
Euro

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 03/03/2009 by Bernard V Liengme
'
'
Range("A2").Select
Selection.NumberFormat = "[$?-2] #,##0.00"
End Sub

I edited this to become
Sub Euro()
ActiveCell.NumberFormat = "[$?-2] #,##0.00"
End Sub


Next use View | Toolbars | Forma to add three buttons to your worksheet
Assign one of your macros to each button as you make them
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

message
Hi all,

I'm working in a spreadsheet with different currencies.

Is there a way to create buttons to change the format of a cell to a
different currency? I'd need 3 of them (for ?, $ and £ )

thx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top