These several if statements perform exactly as I need but I'm wondering if there is a condensed way to achieve the same results?
Private Sub Accountnumber_Change()
If Accountnumber = "500" Then
UserForm1.Check500.Value = True
UserForm1.TextBox500.Value = Invoiceamount
End If
If Accountnumber = "513" Then
UserForm1.Check513.Value = True
UserForm1.TextBox513.Value = Invoiceamount
End If
If Accountnumber = "510" Then
UserForm1.Check510.Value = True
UserForm1.TextBox510.Value = Invoiceamount
End If
If Accountnumber = "610" Then
UserForm1.Check610.Value = True
UserForm1.TextBox610.Value = Invoiceamount
End If
If Accountnumber = "612" Then
UserForm1.Check612.Value = True
UserForm1.TextBox612.Value = Invoiceamount
End If
If Accountnumber = "613" Then
UserForm1.Check613.Value = True
UserForm1.TextBox613.Value = Invoiceamount
End If
If Accountnumber = "614" Then
UserForm1.Check614.Value = True
UserForm1.TextBox614.Value = Invoiceamount
End If
If Accountnumber = "617" Then
UserForm1.Check617.Value = True
UserForm1.TextBox617.Value = Invoiceamount
End If
If Accountnumber = "624" Then
UserForm1.Check624.Value = True
UserForm1.TextBox624.Value = Invoiceamount
End If
End Sub
I also need to add:
If Accountnumber <> (any of the above numbers) then
Textboxother = Accountnumber
Textboxotherdollar = Invoiceamount
End If
Thanks,
Private Sub Accountnumber_Change()
If Accountnumber = "500" Then
UserForm1.Check500.Value = True
UserForm1.TextBox500.Value = Invoiceamount
End If
If Accountnumber = "513" Then
UserForm1.Check513.Value = True
UserForm1.TextBox513.Value = Invoiceamount
End If
If Accountnumber = "510" Then
UserForm1.Check510.Value = True
UserForm1.TextBox510.Value = Invoiceamount
End If
If Accountnumber = "610" Then
UserForm1.Check610.Value = True
UserForm1.TextBox610.Value = Invoiceamount
End If
If Accountnumber = "612" Then
UserForm1.Check612.Value = True
UserForm1.TextBox612.Value = Invoiceamount
End If
If Accountnumber = "613" Then
UserForm1.Check613.Value = True
UserForm1.TextBox613.Value = Invoiceamount
End If
If Accountnumber = "614" Then
UserForm1.Check614.Value = True
UserForm1.TextBox614.Value = Invoiceamount
End If
If Accountnumber = "617" Then
UserForm1.Check617.Value = True
UserForm1.TextBox617.Value = Invoiceamount
End If
If Accountnumber = "624" Then
UserForm1.Check624.Value = True
UserForm1.TextBox624.Value = Invoiceamount
End If
End Sub
I also need to add:
If Accountnumber <> (any of the above numbers) then
Textboxother = Accountnumber
Textboxotherdollar = Invoiceamount
End If
Thanks,