ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   formatting variables (https://www.excelbanter.com/excel-programming/348753-formatting-variables.html)

JT

formatting variables
 
I have a macro that outputs the following line on an Excel spreadsheet:

2260.54 is the amount for your group.

The code is as follows:

activecell.offset (0,5) = vGrpAmt & " is the amount for your group"

I would like for it to display as follows:

$ 2,260.54 is the amount for your group.

I'm having trouble getting the dollar sign and commas to display in the
output. Any suggestions would be appreciated. Thanks for the help.........
--
JT

Toppers

formatting variables
 


ActiveCell.Offset(0, 5) = Format(vGrpAmt, "$0,000.00") & " is the amount for
your group"

"JT" wrote:

I have a macro that outputs the following line on an Excel spreadsheet:

2260.54 is the amount for your group.

The code is as follows:

activecell.offset (0,5) = vGrpAmt & " is the amount for your group"

I would like for it to display as follows:

$ 2,260.54 is the amount for your group.

I'm having trouble getting the dollar sign and commas to display in the
output. Any suggestions would be appreciated. Thanks for the help.........
--
JT


Dave Peterson

formatting variables
 
activecell.offset (0,5) _
= format(vGrpAmt, "$ #,###.00") & " is the amount for your group"

or something close to that.

JT wrote:

I have a macro that outputs the following line on an Excel spreadsheet:

2260.54 is the amount for your group.

The code is as follows:

activecell.offset (0,5) = vGrpAmt & " is the amount for your group"

I would like for it to display as follows:

$ 2,260.54 is the amount for your group.

I'm having trouble getting the dollar sign and commas to display in the
output. Any suggestions would be appreciated. Thanks for the help.........
--
JT


--

Dave Peterson

JE McGimpsey

formatting variables
 
One way:

ActiveCell.Offset(0, 5).Value = Format(vGrpAmt, _
"$ #,##0.00 ""is the amount for your group""")


In article ,
"JT" wrote:

I have a macro that outputs the following line on an Excel spreadsheet:

2260.54 is the amount for your group.

The code is as follows:

activecell.offset (0,5) = vGrpAmt & " is the amount for your group"

I would like for it to display as follows:

$ 2,260.54 is the amount for your group.

I'm having trouble getting the dollar sign and commas to display in the
output. Any suggestions would be appreciated. Thanks for the help.........


William Horton

formatting variables
 
WS.Range("A2").Value = FormatCurrency(vGrpAmt) & " is the amount for your
group."

Changing WS.Range("A2").Value to whatever is your cell.

Bill Horton

"JT" wrote:

I have a macro that outputs the following line on an Excel spreadsheet:

2260.54 is the amount for your group.

The code is as follows:

activecell.offset (0,5) = vGrpAmt & " is the amount for your group"

I would like for it to display as follows:

$ 2,260.54 is the amount for your group.

I'm having trouble getting the dollar sign and commas to display in the
output. Any suggestions would be appreciated. Thanks for the help.........
--
JT



All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com