I've created this code to format my textbox, which is working well
However I noticed that once the data is being input, the %sign on TextBox6 & 8 disappear..
It may have something to do with the Me.TextBox6.Value = "" code, is there any suggestion to keep the formatting while clearing up the value inside?
Regards,
vin
Code:
Private Sub UserForm_Initialize()
TextBox1.Value = Format(Date, "mm/dd/yyyy")
TextBox6.Value = Format(Val(TextBox6.Value), "#%")
TextBox8.Value = Format(Val(TextBox8.Value), "#%")
Ens Sub
However I noticed that once the data is being input, the %sign on TextBox6 & 8 disappear..
Code:
Private Sub cmdAdd_Click()
If MsgBox("Do you want to input the data?", vbYesNo) = vbYes Then
'Copy input values to sheet.
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Data")
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
With ws
.Cells(lRow, 11).Value = Me.TextBox6.Value
.Cells(lRow, 12).Value = Me.TextBox7.Value
.Cells(lRow, 13).Value = Me.TextBox8.Value
End With
Me.TextBox6.Value = ""
Me.TextBox7.Value = ""
Me.TextBox8.Value = ""
Else
End If
End Sub
It may have something to do with the Me.TextBox6.Value = "" code, is there any suggestion to keep the formatting while clearing up the value inside?
Regards,
vin