From: slstaggs on
Hello,

I've successfully created a PP slide where I can enter values and click a
"calculate" button to automatically see my results (thanks in large part to
this forum!) ...

What I can't seem to do however is format the results as either a number
with the thousands separator, or as currency - either USD or Euro.

My (partial) code currently looks like this:

Private Sub Calculate_Click()
On Error GoTo Err1
Annual_Departures1.Value = Daily_Departures.Value * 365
Annual_Departures2.Value = Daily_Departures.Value * 365
Annual_Departures3.Value = Daily_Departures.Value * 365
Taxi_Ops1.Value = Annual_Departures1.Value * 2
Taxi_Ops2.Value = Annual_Departures1.Value * 2
Taxi_Ops3.Value = Annual_Departures1.Value * 2
TROT1.Value = Taxi_Ops1.Value * 15 / 3600
TROT2.Value = Taxi_Ops1.Value * 22.5 / 3600
TROT3.Value = Taxi_Ops1.Value * 30 / 3600
Savings1.Value = TROT1.Value * OC.Value
Savings2.Value = TROT2.Value * OC.Value
Savings3.Value = TROT3.Value * OC.Value
GoTo Done
Err1:
MsgBox "Please enter values for both 'Airline Daily Departures' and
'Operating
Cost per Hour' before calculating.", vbOKOnly, "Calculating Error
Message"
Done:
End Sub

Private Sub Savings1_Change()

End Sub

Private Sub Savings2_Change()

End Sub

Private Sub Savings3_Change()

End Sub

I've done some research on VB coding and I see where they have codes for
currency formatting, but I can't figure out WHERE to put the codes ...

Any help you could provide is greatly appreciated!

Regards,

Shanda

From: John Wilson john AT technologytrish.co DOT on
See if something like this works
Thousands
Annual_Departures1.Value = Format(Daily_Departures.Value * 365, "#,#.00")
Dollars
Annual_Departures1.Value = "$" & Format(Daily_Departures.Value * 365,
"#,#.00")
--
john ATSIGN PPTAlchemy.co.uk

Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html






"slstaggs" wrote:

> Hello,
>
> I've successfully created a PP slide where I can enter values and click a
> "calculate" button to automatically see my results (thanks in large part to
> this forum!) ...
>
> What I can't seem to do however is format the results as either a number
> with the thousands separator, or as currency - either USD or Euro.
>
> My (partial) code currently looks like this:
>
> Private Sub Calculate_Click()
> On Error GoTo Err1
> Annual_Departures1.Value = Daily_Departures.Value * 365
> Annual_Departures2.Value = Daily_Departures.Value * 365
> Annual_Departures3.Value = Daily_Departures.Value * 365
> Taxi_Ops1.Value = Annual_Departures1.Value * 2
> Taxi_Ops2.Value = Annual_Departures1.Value * 2
> Taxi_Ops3.Value = Annual_Departures1.Value * 2
> TROT1.Value = Taxi_Ops1.Value * 15 / 3600
> TROT2.Value = Taxi_Ops1.Value * 22.5 / 3600
> TROT3.Value = Taxi_Ops1.Value * 30 / 3600
> Savings1.Value = TROT1.Value * OC.Value
> Savings2.Value = TROT2.Value * OC.Value
> Savings3.Value = TROT3.Value * OC.Value
> GoTo Done
> Err1:
> MsgBox "Please enter values for both 'Airline Daily Departures' and
> 'Operating
> Cost per Hour' before calculating.", vbOKOnly, "Calculating Error
> Message"
> Done:
> End Sub
>
> Private Sub Savings1_Change()
>
> End Sub
>
> Private Sub Savings2_Change()
>
> End Sub
>
> Private Sub Savings3_Change()
>
> End Sub
>
> I've done some research on VB coding and I see where they have codes for
> currency formatting, but I can't figure out WHERE to put the codes ...
>
> Any help you could provide is greatly appreciated!
>
> Regards,
>
> Shanda
>
From: slstaggs on
Hi John,

I played around with your suggestions a little and came up with:

Savings1.Value = Format(TROT1.Value * OC.Value, "$ #,###")

Works like a charm - thank you so much!!

For future reference, if I have more questions regarding MS Visual Basic
coding (which I'm sure I will!) is this the best forum on which to post?

Best regards,

Shanda

"John Wilson" wrote:

> See if something like this works
> Thousands
> Annual_Departures1.Value = Format(Daily_Departures.Value * 365, "#,#.00")
> Dollars
> Annual_Departures1.Value = "$" & Format(Daily_Departures.Value * 365,
> "#,#.00")
> --
> john ATSIGN PPTAlchemy.co.uk
>
> Free PPT Hints, Tips and Tutorials
> http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html
>
>
>
>
>
>
> "slstaggs" wrote:
>
> > Hello,
> >
> > I've successfully created a PP slide where I can enter values and click a
> > "calculate" button to automatically see my results (thanks in large part to
> > this forum!) ...
> >
> > What I can't seem to do however is format the results as either a number
> > with the thousands separator, or as currency - either USD or Euro.
> >
> > My (partial) code currently looks like this:
> >
> > Private Sub Calculate_Click()
> > On Error GoTo Err1
> > Annual_Departures1.Value = Daily_Departures.Value * 365
> > Annual_Departures2.Value = Daily_Departures.Value * 365
> > Annual_Departures3.Value = Daily_Departures.Value * 365
> > Taxi_Ops1.Value = Annual_Departures1.Value * 2
> > Taxi_Ops2.Value = Annual_Departures1.Value * 2
> > Taxi_Ops3.Value = Annual_Departures1.Value * 2
> > TROT1.Value = Taxi_Ops1.Value * 15 / 3600
> > TROT2.Value = Taxi_Ops1.Value * 22.5 / 3600
> > TROT3.Value = Taxi_Ops1.Value * 30 / 3600
> > Savings1.Value = TROT1.Value * OC.Value
> > Savings2.Value = TROT2.Value * OC.Value
> > Savings3.Value = TROT3.Value * OC.Value
> > GoTo Done
> > Err1:
> > MsgBox "Please enter values for both 'Airline Daily Departures' and
> > 'Operating
> > Cost per Hour' before calculating.", vbOKOnly, "Calculating Error
> > Message"
> > Done:
> > End Sub
> >
> > Private Sub Savings1_Change()
> >
> > End Sub
> >
> > Private Sub Savings2_Change()
> >
> > End Sub
> >
> > Private Sub Savings3_Change()
> >
> > End Sub
> >
> > I've done some research on VB coding and I see where they have codes for
> > currency formatting, but I can't figure out WHERE to put the codes ...
> >
> > Any help you could provide is greatly appreciated!
> >
> > Regards,
> >
> > Shanda
> >