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.
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
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 £
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
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.