Im creating a userform, and I have textbox that people put some information and the others are updated.
For example I have:
then i have commandbutton which someone would click and then the information would automatically populate into the textbox7, (in this situation).Public Sub TextBox7_enter() If TextBox3.Value = "" Then TextBox7.Value = 0 Else TextBox7.Value = (TextBox3.Value * (TextBox27.Value / 100)) + TextBox3.Value TextBox7.Value = Format(TextBox7.Value, "#,##0.00") End If end sub
However, the textbox's (all of them) dont update, they only update when I hit enter in each one, of course because I have it set up as public textbox7_enter()Public Sub CommandButton1_Click() TextBox7.Repaint End Sub
I want to know a function where i can install it in the commandbutton1 and it will update automatically the textboxes with new data. (not to erase the data) but to calculate the data.
anyone can help me, thank you, :0)
Last edited by gill389; 05-17-2011 at 12:44 PM.
When you define all the values for each text box just repaint them all at the same timePublic Sub TextBox7_enter() If TextBox3.Value = "" Then TextBox7.Value = 0 Else TextBox7.Value = (TextBox3.Value * (TextBox27.Value / 100)) + TextBox3.Value TextBox7.Value = Format(TextBox7.Value, "#,##0.00") TextBox8.Value = (TextBox3.Value * (TextBox27.Value / 100)) + TextBox3.Value TextBox8.Value = Format(TextBox7.Value, "#,##0.00") TextBox9.Value = (TextBox3.Value * (TextBox27.Value / 100)) + TextBox3.Value TextBox9.Value = Format(TextBox7.Value, "#,##0.00") End If end sub
Public Sub CommandButton1_Click() TextBox7.Repaint TextBox8.Repaint TextBox9.Repaint End Sub
Use the right event.
Public Sub TextBox7_Change() application.enableevents=false With TextBox3 TextBox7.Text = iif(.Text="0",0,format(.Text * TextBox27.Text / 100 + .Text, "#,##0.00")) End with Application.Enableevents=true end sub
Last edited by snb; 05-17-2011 at 10:32 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks