Macro help please!

eddy

Well-known Member
Joined
Mar 2, 2002
Messages
521
I need a macro which will format cells H21 to H34 and I35 TO I38 to either Sterling £(2 decimal Places) or Dollar $(2 decimalplaces).
To be triggered by a Question or maybe tick Boxes.

All help most appreciated.

Regards Ed
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Try

Code:
Sub test()
If MsgBox("£", vbYesNo + vbQuestion) = vbYes Then
    Range("H21:H34,I35:I38").NumberFormat = "$#,##0.00"
Else
    Range("H21:H34,I35:I38").NumberFormat = "[$$-409]#,##0.00"
End If
End Sub
 
Upvote 0
This works a treat many thanks for your help.
Much appreciated.
Just as a matter of interest. Could this formatting be automatically triggered by the entry in Cell E13.
e.g If Cell E13 = Andrel Electronics or Cardel Elecronics then format the ranges in $ ELSE format in £

Regards Ed
 
Upvote 0
Try

Code:
Sub test()
If Range("E13").Value = "Andrel Electronics" Or Range("E13").Value = "Cardel Elecronics" Then
    Range("H21:H34,I35:I38").NumberFormat = "[$$-409]#,##0.00"
Else
    Range("H21:H34,I35:I38").NumberFormat = "$#,##0.00"
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,034
Messages
6,122,782
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top