T
Todd Huttenstine
Below is code that inserts the value of the specified
textbox into the specified cell.
Private Sub CommandButton2_Click()
Worksheets("Pay Calculator").Range("AA1").Value =
TextBox1.Value
Worksheets("Pay Calculator").Range("AA2").Value =
TextBox2.Value
Worksheets("Pay Calculator").Range("AA3").Value =
TextBox3.Value
Worksheets("Pay Calculator").Range("AA4").Value =
TextBox4.Value
UserForm1.Hide
End Sub
I have formatted the cells in percentages rounded off to 2
decimal places. For instance if I were to enter 10
directly in the cell, the cell would show 10%. So now if
I were to enter 10 in TextBox1, I want it to put 10% in
cell AA1, instead it puts 1000% in the cell, however if I
were to enter 10% in TextBox1, it then puts 10% in cell
AA1 which is what I want, but I dont want to have to type
the % in.
Is there a way I can make it to where no matter what is
typed in the text box it will automatically have the % on
the end of the number in the textbox. Or is it possible
to when I type in a number in the textbox without a % on
the end, it will automatically put 10% in the cell? What
is the code for these 2 methods?
Thank you.
textbox into the specified cell.
Private Sub CommandButton2_Click()
Worksheets("Pay Calculator").Range("AA1").Value =
TextBox1.Value
Worksheets("Pay Calculator").Range("AA2").Value =
TextBox2.Value
Worksheets("Pay Calculator").Range("AA3").Value =
TextBox3.Value
Worksheets("Pay Calculator").Range("AA4").Value =
TextBox4.Value
UserForm1.Hide
End Sub
I have formatted the cells in percentages rounded off to 2
decimal places. For instance if I were to enter 10
directly in the cell, the cell would show 10%. So now if
I were to enter 10 in TextBox1, I want it to put 10% in
cell AA1, instead it puts 1000% in the cell, however if I
were to enter 10% in TextBox1, it then puts 10% in cell
AA1 which is what I want, but I dont want to have to type
the % in.
Is there a way I can make it to where no matter what is
typed in the text box it will automatically have the % on
the end of the number in the textbox. Or is it possible
to when I type in a number in the textbox without a % on
the end, it will automatically put 10% in the cell? What
is the code for these 2 methods?
Thank you.