How can I properly display the currency value in the message box?
Answer: You will need to use the Format function to properly display the currency value.
For example, you could use the following code to correct the display of your message box:
Sub DisplayCost()
Dim strcost As Currency
strcost = 2.5
'Display the total cost
MsgBox "The Total Cost for this Audit is " & Format(strcost, "Currency")
End Sub
This would properly display your 2.5 stored in the strcost variable as £2.50.
Your message box should now display as:
No comments:
Post a Comment