How can I display the textbox value in "%" format?
[vba]
.TextBox1.Value = c.Offset(0, 28).Value
[/vba]
Printable View
How can I display the textbox value in "%" format?
[vba]
.TextBox1.Value = c.Offset(0, 28).Value
[/vba]
I believe it's something like this used in the Sub tetxbox1_change:
[vba]
Me.TextBox1.Value = Format(Textbox1.Value, "%")
[/vba]where Me will be the object it resides in, if you are using it in code not in the object module you need to specify the object i.e Userform1.TextBox1.....etc
Regards
Simon
To change 15 to 15.00%
[VBA]Me.TextBox1.Value = Format(TextBox1.Value / 100, "0.00%")[/VBA]
LOL i was close!
Save data in the worksheet using TextBox1 (Perfect Code). Thanks "mdmackillop" for this code. It makes the user entry more easier.
[vba]
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.TextBox1.Value = Format(TextBox1.Value / 100, "0.0%")
End Sub
[/vba]
But when I call back the data in the worksheet using TextBox1, 10% becomes 0.1 in the textbox happens when I used below code.
Call data from the worksheet using TextBox1
[vba]
.TextBox1.Value = c.Offset(0, 28).Value
[/vba]
[VBA].TextBox1.Value = Format(c.Offset(0, 28).Value ,"0.0%)[/VBA]
:bow: mdmackillop :bow: Perfect. Thanks
What about passing a null value with this code...Quote:
Originally Posted by mdmackillop
[VBA]
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)[/VBA]
Me.TextBox1.Value = Format(TextBox1.Value / 100, "0.0%")
End Sub
Use the text property [vba] .TextBox1.Value = c.Offset(0, 28).Text [/vba]
I have this code in the textbox. When I skip the textbox1 error come which is data type mismatch that made me into conclusion that skipping the textbox1 is not permitted. What I want to happen is a code if it's possible to skip textbox1 and entry to be made in textbox2.
[vba]
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.TextBox1.Value = Format(TextBox1.Value / 100, "0.0%")
End Sub [/vba]
[vba]
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.TextBox2.Value = Format(TextBox2.Value / 100, "0.0%")
End Sub
[/vba]
[vba]
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With Me.TextBox1
If .Value = "" Then
.Value = 0
End If
.Value = Format(.Value / 100, "0.0%")
End With
End Sub
[/vba]
xld :cool: ... this code works perfectly... once again thanks.
Quote:
Originally Posted by xld