unable to populate a textbox with userform

rooster05

New Member
Joined
Mar 4, 2017
Messages
34
Hi everyone,

i have a userform that dependent on whether textbox/combobox has a value the next TB/CB becomes visible, this is all fine until i get to the 9th box, i am then unable to populate this field. i am stumped i have deleted some code, and deleted blank lines. Has anyone got any suggestions the code is quite long and not necessarily in the right order of TB/CB. the TB i am unable to populate is TB13

thanks in advance

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
TextBox2.Visible = True
Label3.Visible = True
Else
TextBox2.Visible = False
Label3.Visible = False
Label4.Visible = False
TextBox3.Visible = False
Label5.Visible = False
TextBox4.Visible = False
Label7.Visible = False
TextBox6.Visible = False
End If
End Sub
Private Sub ComboBox4_Change()
If TextBox1.Value > "" And ComboBox4.Value > "" Then
TextBox2.Value = ""
TextBox2.Visible = True
Label3.Visible = True
Else
TextBox2.Visible = False
Label3.Visible = False
Label4.Visible = False
TextBox3.Visible = False
Label5.Visible = False
TextBox4.Visible = False
Label7.Visible = False
TextBox6.Visible = False
End If
End Sub
Private Sub CommandButton1_Click()
'Range("a1").Select
'Upload to Sheet2 in excel and generate PDF and email to relevant inbox
Sheets("Sheet2").Select
Range("c1").Select
ActiveCell.End(xlDown).Offset(5, 0).Select
ActiveCell.Value = ComboBox1.Value
Range("c1").Select
ActiveCell.End(xlDown).Offset(6, 0).Select
ActiveCell.Value = TextBox1.Value
Range("c1").Select
ActiveCell.End(xlDown).Offset(7, 0).Select
ActiveCell.Value = ComboBox4.Value
Range("c1").Select
ActiveCell.End(xlDown).Offset(8, 0).Select
ActiveCell.Value = TextBox2.Value
Range("c1").Select
ActiveCell.End(xlDown).Offset(9, 0).Select
ActiveCell.Value = TextBox3.Value
Range("c1").Select
ActiveCell.End(xlDown).Offset(10, 0).Select
ActiveCell.Value = TextBox4.Value
Range("c1").Select
ActiveCell.End(xlDown).Offset(11, 0).Select
ActiveCell.Value = TextBox6.Value
Range("c1").Select
ActiveCell.End(xlDown).Offset(13, 0).Select
ActiveCell.Value = TextBox5.Value
Range("c1").Select
ActiveCell.End(xlDown).Offset(14, 0).Select
ActiveCell.Value = TextBox11.Value
Range("c1").Select
ActiveCell.End(xlDown).Offset(15, 0).Select
ActiveCell.Value = TextBox10.Value
Range("c1").Select
ActiveCell.End(xlDown).Offset(16, 0).Select
ActiveCell.Value = TextBox9.Value
Range("c1").Select
ActiveCell.End(xlDown).Offset(17, 0).Select
ActiveCell.Value = TextBox8.Value
Range("c1").Select
ActiveCell.End(xlDown).Offset(18, 0).Select
ActiveCell.Value = TextBox7.Value
Unload Me
End Sub






Private Sub TextBox10_Change()
If TextBox11.Value > "" Then
TextBox10.Value = ""
Label12.Visible = True
TextBox10.Visible = True
Else
Label12.Visible = False
TextBox10.Visible = False
Label11.Visible = False
TextBox9.Visible = False
Label10.Visible = False
TextBox8.Visible = False
Label9.Visible = False
TextBox7.Visible = False
End If
End Sub
Private Sub TextBox11_Change()
If TextBox5.Value > "" Then
TextBox11.Value = ""
Label13.Visible = True
TextBox11.Visible = True
Else
Label13.Visible = False
TextBox11.Visible = False
Label12.Visible = False
TextBox10.Visible = False
Label11.Visible = False
TextBox9.Visible = False
Label10.Visible = False
TextBox8.Visible = False
Label9.Visible = False
TextBox7.Visible = False
End If
End Sub
Private Sub TextBox13_Change()
If TextBox5.Value > "" Then
TextBox13.Value = ""
Label13.Visible = True
TextBox13.Visible = True
Else
Label13.Visible = False
TextBox13.Visible = False
Label12.Visible = False
TextBox10.Visible = False
Label11.Visible = False
TextBox9.Visible = False
Label10.Visible = False
TextBox8.Visible = False
Label9.Visible = False
TextBox7.Visible = False
End If
End Sub
Private Sub TextBox2_Change()
If TextBox2.Value > "" Then
TextBox3.Value = ""
Label4.Visible = True
TextBox3.Visible = True
Else
Label4.Visible = False
TextBox3.Visible = False
Label5.Visible = False
TextBox4.Visible = False
Label7.Visible = False
TextBox6.Visible = False
End If
End Sub
Private Sub TextBox3_Change()
If TextBox3.Value > "" Then
TextBox4.Value = ""
Label5.Visible = True
TextBox4.Visible = True
Else
Label5.Visible = False
TextBox4.Visible = False
Label7.Visible = False
TextBox6.Visible = False
End If
End Sub
Private Sub TextBox4_Change()
If TextBox4.Value > "" Then
TextBox6.Value = ""
Label7.Visible = True
TextBox6.Visible = True
Else
Label7.Visible = False
TextBox6.Visible = False
End If
End Sub
Private Sub TextBox5_Change()
If TextBox5.Value > "" Then
TextBox13.Value = ""
Label13.Visible = True
TextBox13.Visible = True
Else
Label13.Visible = False
TextBox13.Visible = False
Label12.Visible = False
TextBox10.Visible = False
Label11.Visible = False
TextBox9.Visible = False
Label10.Visible = False
TextBox8.Visible = False
Label9.Visible = False
TextBox7.Visible = False
End If
End Sub
Private Sub TextBox6_Change()
If ComboBox1.Value = "Add a line (Grade authority required)" And TextBox6.Value > "" Then
TextBox5.Visible = True
Label6.Visible = True
Else
If ComboBox1.Value = "Add a Non VAT line (Grade authority required)" And TextBox6.Value > "" Then
TextBox5.Visible = True
Label6.Visible = True
Else
TextBox5.Visible = False
Label6.Visible = False
End If
End If
End Sub
Private Sub TextBox7_Change()
If TextBox8.Value > "" Then
TextBox7.Value = ""
Label9.Visible = True
TextBox7.Visible = True
Else
Label9.Visible = False
TextBox7.Visible = False
End If
End Sub
Private Sub TextBox8_Change()
If TextBox9.Value > "" Then
TextBox8.Value = ""
Label10.Visible = True
TextBox8.Visible = True
Else
Label10.Visible = False
TextBox8.Visible = False
Label9.Visible = False
TextBox7.Visible = False
End If
End Sub
Private Sub TextBox9_Change()
If TextBox10.Value > "" Then
TextBox9.Value = ""
Label11.Visible = True
TextBox9.Visible = True
Else
Label11.Visible = False
TextBox9.Visible = False
Label10.Visible = False
TextBox8.Visible = False
Label9.Visible = False
TextBox7.Visible = False
End If
End Sub
Private Sub combobox1_change()
Application.EnableEvents = False


If (ComboBox1.Value) = "Add a line (Grade authority required)" Then
TextBox1.Visible = True
Label1.Visible = True
ComboBox4.Visible = True
Label14.Visible = True
CheckBox1.Visible = False
Else
If (ComboBox1.Value) = "Amend/Change Cost Centre (Grade authority required)" Then
TextBox1.Visible = True
Label1.Visible = True
ComboBox4.Visible = True
Label14.Visible = True
CheckBox1.Visible = False
Else
If (ComboBox1.Value) = "Add a Non VAT line (Grade authority required)" Then
TextBox1.Visible = True
Label1.Visible = True
ComboBox4.Visible = True
Label14.Visible = True
CheckBox1.Visible = False
Else
If (ComboBox1.Value) = "Change Vat code (Grade authority required)" Then
TextBox1.Visible = True
Label1.Visible = True
ComboBox4.Visible = True
Label14.Visible = True
CheckBox1.Visible = False
Else
If (ComboBox1.Value) = "Limit Order value increase (Grade authority required)" Then
TextBox1.Visible = True
Label1.Visible = True
ComboBox4.Visible = True
Label14.Visible = True
CheckBox1.Visible = False
Else
If (ComboBox1.Value) = "Purchase Order Quantity increase (Grade authority required)" Then
TextBox1.Visible = True
Label1.Visible = True
ComboBox4.Visible = True
Label14.Visible = True
CheckBox1.Visible = False
Else
If (ComboBox1.Value) = "Purchase Order Unit Price increase (Grade authority required)" Then
TextBox1.Visible = True
Label1.Visible = True
ComboBox4.Visible = True
Label14.Visible = True
CheckBox1.Visible = False
Else
If (ComboBox1.Value) = "Re-open a Purchase Order (Grade authority required)" Then
TextBox1.Visible = True
Label1.Visible = True
ComboBox4.Visible = True
Label14.Visible = True
CheckBox1.Visible = False
Else
If (ComboBox1.Value) = "Re-open a Limit Order (Grade authority required)" Then
TextBox1.Visible = True
Label1.Visible = True
ComboBox4.Visible = True
Label14.Visible = True
CheckBox1.Visible = False
Else
If (ComboBox1.Value) = "Amend Material Group Code (Grade authority required)" Then
TextBox1.Visible = True
Label1.Visible = True
ComboBox4.Visible = True
Label14.Visible = True
CheckBox1.Visible = False
Else
TextBox1.Visible = False
Label1.Visible = False
ComboBox4.Visible = False
If (ComboBox1.Value) = "Decrease line value" Then
CheckBox1.Visible = True
Else
CheckBox1.Visible = False
If (ComboBox1.Value) = "Increase line value" Then
CheckBox1.Visible = True
Else
CheckBox1.Visible = False
If (ComboBox1.Value) = "Cancel/delete Purchase Order line/s (No Authority/Supplier notified)" Then
CheckBox1.Visible = True
Else
CheckBox1.Visible = False
If (ComboBox1.Value) = "Amend/Change Line Description (No Authority/Approver notified)" Then
CheckBox1.Visible = True
Else
CheckBox1.Visible = False
If (ComboBox1.Value) = "Close/reduce Limit Order line/s (No Authority/Approver notified)" Then
CheckBox1.Visible = True
Else
CheckBox1.Visible = False
If (ComboBox1.Value) = "Limit Order value decrease (No Authority/Approver notified)" Then
CheckBox1.Visible = True
Else
CheckBox1.Visible = False
If (ComboBox1.Value) = "Purchase Order Quantity decrease (No Authority/Approver notified)" Then
CheckBox1.Visible = True
Else
CheckBox1.Visible = False
If (ComboBox1.Value) = "Purchase Order Unit Price decrease (No Authority/Approver notified)" Then
CheckBox1.Visible = True
Else
CheckBox1.Visible = False
If (ComboBox1.Value) = "Amend receipt to 2-Way match (No Authority/Approver notified)" Then
CheckBox1.Visible = True
Else
CheckBox1.Visible = False
If (ComboBox1.Value) = "Amend receipt to 3-Way match (No Authority/Approver notified)" Then
CheckBox1.Visible = True
Else
CheckBox1.Visible = False
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End Sub
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Check the Tbx properties & ensure that Enabled=True
 
Upvote 0
thanks, locked = false.
if i remove the line TextBox13.Value = "" i can then populate, i'm baffled by this
 
Upvote 0
:confused:
Pass, the fact that you are clearing the textbox, shouldn't prevent you from entering something into it.
 
Upvote 0
thanks for the input, glad it's not just me, think i'll have to have a rethink on the design
thanks again
 
Upvote 0
Wish I could have helped further
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,334
Members
452,636
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top