Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Question
Hello
I have a created a userform and would like the values in txtBox3-txtBox10 to default to the value in txtBox1 once it is entered. So if I enter 100 in txtBox1 and then go to txtBox2 the values in 3-7 will be 100 also. I am new to user forms and I dont know how to do this. All help would be greatly appreciated! Thanks in advance Sharon |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Question
TextBoxes have a Change event. You might be able to use this to set
txtBox2.Text = txtBox1.Text, etc. HTH Ed "Sharon" wrote in message ... Hello I have a created a userform and would like the values in txtBox3-txtBox10 to default to the value in txtBox1 once it is entered. So if I enter 100 in txtBox1 and then go to txtBox2 the values in 3-7 will be 100 also. I am new to user forms and I dont know how to do this. All help would be greatly appreciated! Thanks in advance Sharon |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Question
Private Sub TextBox1_Change() With Me.TextBox1 TextBox2.Text = .Text TextBox3.Text = .Text TextBox4.Text = .Text TextBox5.Text = .Text TextBox6.Text = .Text TextBox7.Text = .Text End With End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Sharon" wrote in message ... Hello I have a created a userform and would like the values in txtBox3-txtBox10 to default to the value in txtBox1 once it is entered. So if I enter 100 in txtBox1 and then go to txtBox2 the values in 3-7 will be 100 also. I am new to user forms and I dont know how to do this. All help would be greatly appreciated! Thanks in advance Sharon |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Question
Use the exit event of the Textbox1
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) If trim(Textbox1.Text) < "" then for i = 3 to 10 me.controls("TextBox" & i).Text = Textbox1.Text Next End if End Sub If you only want this behavior if the textboxes 3 to 10 are empty Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) If trim(Textbox1.Text) < "" then for i = 3 to 10 if trim(me.controls("Textbox" & i).Text) = "" then me.controls("TextBox" & i).Text = Textbox1.Text End if Next End if End Sub -- Regards, Tom Ogilvy "Sharon" wrote in message ... Hello I have a created a userform and would like the values in txtBox3-txtBox10 to default to the value in txtBox1 once it is entered. So if I enter 100 in txtBox1 and then go to txtBox2 the values in 3-7 will be 100 also. I am new to user forms and I dont know how to do this. All help would be greatly appreciated! Thanks in advance Sharon |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Question
Thanks Bob
A followup question: How would I modify if in textBox8 and TextBox9 the values 2 and 5 respectively for it to change textBox2 through textBox5, and not 6 and 7? Thanks! "Bob Phillips" wrote: Private Sub TextBox1_Change() With Me.TextBox1 TextBox2.Text = .Text TextBox3.Text = .Text TextBox4.Text = .Text TextBox5.Text = .Text TextBox6.Text = .Text TextBox7.Text = .Text End With End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Sharon" wrote in message ... Hello I have a created a userform and would like the values in txtBox3-txtBox10 to default to the value in txtBox1 once it is entered. So if I enter 100 in txtBox1 and then go to txtBox2 the values in 3-7 will be 100 also. I am new to user forms and I dont know how to do this. All help would be greatly appreciated! Thanks in advance Sharon |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Question
Enamored with repetitiveness you asked:
How would I modify if in textBox8 and TextBox9 the values 2 and 5 respectively for it to change textBox2 through textBox5, and not 6 and 7? Private Sub TextBox1_Change() With Me.TextBox1 TextBox2.Text = .Text TextBox3.Text = .Text TextBox4.Text = .Text TextBox5.Text = .Text ' TextBox6.Text = .Text ' TextBox7.Text = .Text TextBox8.Text = 2 TextBox9.Text = 5 End With End Sub However, using the exit event would be a better choice. -- Regards, Tom Ogilvy "Sharon" wrote in message ... Thanks Bob A followup question: How would I modify if in textBox8 and TextBox9 the values 2 and 5 respectively for it to change textBox2 through textBox5, and not 6 and 7? Thanks! "Bob Phillips" wrote: Private Sub TextBox1_Change() With Me.TextBox1 TextBox2.Text = .Text TextBox3.Text = .Text TextBox4.Text = .Text TextBox5.Text = .Text TextBox6.Text = .Text TextBox7.Text = .Text End With End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Sharon" wrote in message ... Hello I have a created a userform and would like the values in txtBox3-txtBox10 to default to the value in txtBox1 once it is entered. So if I enter 100 in txtBox1 and then go to txtBox2 the values in 3-7 will be 100 also. I am new to user forms and I dont know how to do this. All help would be greatly appreciated! Thanks in advance Sharon |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Question
Im sorry thats not quite what I meant.....
TextBox1 user enters 100 Textbox8 user enters 2 TextBox9 user enters 5 and then form is updated TextBox2 through TextBox5 =100 TextBox6 and TextBox7 are blank. So the code reads TextBox8 and TextBox9 and then fills in 2-7 based on whats entered in 8 and 9. Sorry for the lack of clarity---it made perfect sense to me LOL I hoep this clarifies a bit "Tom Ogilvy" wrote: Enamored with repetitiveness you asked: How would I modify if in textBox8 and TextBox9 the values 2 and 5 respectively for it to change textBox2 through textBox5, and not 6 and 7? Private Sub TextBox1_Change() With Me.TextBox1 TextBox2.Text = .Text TextBox3.Text = .Text TextBox4.Text = .Text TextBox5.Text = .Text ' TextBox6.Text = .Text ' TextBox7.Text = .Text TextBox8.Text = 2 TextBox9.Text = 5 End With End Sub However, using the exit event would be a better choice. -- Regards, Tom Ogilvy "Sharon" wrote in message ... Thanks Bob A followup question: How would I modify if in textBox8 and TextBox9 the values 2 and 5 respectively for it to change textBox2 through textBox5, and not 6 and 7? Thanks! "Bob Phillips" wrote: Private Sub TextBox1_Change() With Me.TextBox1 TextBox2.Text = .Text TextBox3.Text = .Text TextBox4.Text = .Text TextBox5.Text = .Text TextBox6.Text = .Text TextBox7.Text = .Text End With End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Sharon" wrote in message ... Hello I have a created a userform and would like the values in txtBox3-txtBox10 to default to the value in txtBox1 once it is entered. So if I enter 100 in txtBox1 and then go to txtBox2 the values in 3-7 will be 100 also. I am new to user forms and I dont know how to do this. All help would be greatly appreciated! Thanks in advance Sharon |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Question
All placed in the userform code module
Sub UpdateBoxes() Dim j as Long, k as Long, i as Long if isnumeric(me.Textbox8.Text) then _ j = clng(me.Textbox8.Text) if isnumeric(me.Textbox9.Text) then _ k = clng(me.Textbox9.Text) if j < 2 or j 7 or k < 2 or k 7 then exit sub for i = j to k me.Controls("TextBox" & i).Text = Textbox1.Text Next End Sub Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) UpdateBoxes End Sub Private Sub TextBox8_Exit(ByVal Cancel As MSForms.ReturnBoolean) UpdateBoxes End Sub Private Sub TextBox9_Exit(ByVal Cancel As MSForms.ReturnBoolean) UpdateBoxes End Sub -- Regards, Tom Ogilvy "Sharon" wrote in message ... Im sorry thats not quite what I meant..... TextBox1 user enters 100 Textbox8 user enters 2 TextBox9 user enters 5 and then form is updated TextBox2 through TextBox5 =100 TextBox6 and TextBox7 are blank. So the code reads TextBox8 and TextBox9 and then fills in 2-7 based on whats entered in 8 and 9. Sorry for the lack of clarity---it made perfect sense to me LOL I hoep this clarifies a bit "Tom Ogilvy" wrote: Enamored with repetitiveness you asked: How would I modify if in textBox8 and TextBox9 the values 2 and 5 respectively for it to change textBox2 through textBox5, and not 6 and 7? Private Sub TextBox1_Change() With Me.TextBox1 TextBox2.Text = .Text TextBox3.Text = .Text TextBox4.Text = .Text TextBox5.Text = .Text ' TextBox6.Text = .Text ' TextBox7.Text = .Text TextBox8.Text = 2 TextBox9.Text = 5 End With End Sub However, using the exit event would be a better choice. -- Regards, Tom Ogilvy "Sharon" wrote in message ... Thanks Bob A followup question: How would I modify if in textBox8 and TextBox9 the values 2 and 5 respectively for it to change textBox2 through textBox5, and not 6 and 7? Thanks! "Bob Phillips" wrote: Private Sub TextBox1_Change() With Me.TextBox1 TextBox2.Text = .Text TextBox3.Text = .Text TextBox4.Text = .Text TextBox5.Text = .Text TextBox6.Text = .Text TextBox7.Text = .Text End With End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Sharon" wrote in message ... Hello I have a created a userform and would like the values in txtBox3-txtBox10 to default to the value in txtBox1 once it is entered. So if I enter 100 in txtBox1 and then go to txtBox2 the values in 3-7 will be 100 also. I am new to user forms and I dont know how to do this. All help would be greatly appreciated! Thanks in advance Sharon |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
userform question | Excel Discussion (Misc queries) | |||
UserForm Question | Excel Worksheet Functions | |||
VBA UserForm Question.......Help! | Excel Programming | |||
UserForm question | Excel Programming | |||
userform question | Excel Programming |