PDA

View Full Version : Solved: Formatting Text /Numbers in a Textbox of a Userform



Rlb53
02-05-2012, 09:58 AM
I would like for the Number Format Displayed in the Textbox of the Userform to be in $. Could you assist please?


Private Sub CommandButton_ViewCurrentBaseCost_Click()
Sheets(UserForm6.ComboBox_Vendorlist.Value).Activate
With Range("a1:bb1")
Textbox_RPMPrevCost.Value = .Find(TextBox_RPM.Value).Offset(1, 0).Value
End With
With Range("a1:bb1")
TextBox_RailFeePrevCost.Value = .Find(TextBox_RailFee.Value).Offset(1, 0).Value
End With
With Range("a1:bb1")
TextBox_BargeFeePrevCost.Value = .Find(TextBox_BargeFee.Value).Offset(1, 0).Value
End With
End Sub

Thank you in Advance for your Time !

mgm05267
02-05-2012, 10:15 AM
Hi...

Try this...

Textbox_RPMPrevCost.Value = Format(.Find(TextBox_RPM.Value).Offset(1, 0).Value,"$00.00")

actually not tested

Regards,

MGM

Rlb53
02-05-2012, 10:21 AM
You are The Man !... Perfect ! A minor change. I used $###.## to allow a variable.... Awesome... Thanks !!

Norie
02-06-2012, 06:49 AM
Couldn't you use the Text property instead of Value for the cell?

That will return the value in the cell formatted as it is on the worksheet.