Format Control Toolbox Output

  • Thread starter Thread starter slstaggs
  • Start date Start date
S

slstaggs

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
 
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")
 
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
 
Back
Top