formatting textboxes

R

Roger on Excel

I populate textboxes on a userform with the following code

Private Sub cmdEditChemical_Click()
Dim Chemical As Variant

Chemical =
Sheets("Chemicals").Cells.Find(What:=lstChemicalDatabase.Text,
LookIn:=xlFormulas, _
LookAt:=1, SearchDirection:=xlNext, MatchCase:=False).Offset(0,
0).Address

With Sheets("Chemicals").Range(Chemical)

TextBoxName.Text = .Offset(0, 0)
TextBoxCAS.Text = .Offset(0, 1)
TextBoxMW.Text = .Offset(0, 2)
TextBoxDensity.Text = .Offset(0, 3)
TextBoxConc.Value = .Offset(0, 4)
TextBoxMaterial.Text = .Offset(0, 5)
TextBoxSupplier.Value = .Offset(0, 6)
TextBoxPack.Value = .Offset(0, 7)
TextBoxUnit.Value = .Offset(0, 8)
TextBoxWasteClass.Value = .Offset(0, 9)
TextBoxCost.Value = .Offset(0, 10)

End With
End Sub

I need the textboxes to show particular formatting for example :

TextBoxCost needs to be $0.00 format
or
TextBoxConc needs to be XX.X% format

Can anyone help with the syntax of the code to help me with the formats?
 
G

Gary Keramidas

maybe this will point you in the right direction

Me.TextBox1.Value = Format(Worksheets("Sheet1").Range("A1").Value, "$0.00")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top