Formatting returned values within a text string in VB

DonkeyOte

MrExcel MVP
Joined
Sep 6, 2002
Messages
9,123
I am sure someone has probably explained this before but I have never been able to do the following.

I am running a spreadsheet that analyses actual versus budget positions in real time, part of this solution are automatic warning flag emails that get sent to various departments as and when adverse variances above 10% of budget arise. This is all fine and is coded etc... the problem I have is that when there's an adverse variance the VB creates a text string for the email along thses lines:

Nominal Code - Description of Code - Amount of Variance - "overspend" - in Q# (variable)

The problem is the Amount of Variance as I can not work out how to ensure that this values is returned in the format of #,##0.00

Anyone know how I can amend the below code to have this effect:

Range("P" & CROW) = Range("A" & CROW) & " - " & Range("B" & CROW) & " - " & -NCODE & " Overspend in Q" & Range("N1")

where -NCODE is equivalent to the value.

Thanks
Luke

I help you now you help me?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

dk

MrExcel MVP
Joined
Feb 15, 2002
Messages
2,942
Hello,

Use Format(YourVariable,"#,##0.00")

Is that what you mean?
 

DonkeyOte

MrExcel MVP
Joined
Sep 6, 2002
Messages
9,123
Legends!

Thanks a lot...can't believe it was that simple - what a dunce!
 

Forum statistics

Threads
1,144,056
Messages
5,722,261
Members
422,419
Latest member
Havok390

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
Top