I am lookng to find a way to send and receive a large amount of data between multiple textboxes and cells in worksheets without creating a line of code for each textbox. There is also an "IF" element involved.
Example
Command = Call Data (Via a Command Button in a User Form)
If Criteria value = A Then
TextBox1.Value = Sheet 1 Range A1
TextBox2.Value = Sheet 1 Range A2
TextBox3.Value = Sheet 1 Range A3
TextBox3.Value = Sheet 1 Range B1
TextBox5.Value = Sheet 1 Range B2
TextBox6.Value = Sheet 1 Range B3
TextBox7.Value = Sheet 1 Range C1
TextBox8.Value = Sheet 1 Range C2
TextBox9.Value = Sheet 1 Range C3
End If
If Criteria value = B Then
TextBox1.Value = Sheet 1 Range D1
TextBox2.Value = Sheet 1 Range D2
TextBox3.Value = Sheet 1 Range D3
TextBox3.Value = Sheet 1 Range E1
TextBox5.Value = Sheet 1 Range E2
TextBox6.Value = Sheet 1 Range E3
TextBox7.Value = Sheet 1 Range F1
TextBox8.Value = Sheet 1 Range F2
TextBox9.Value = Sheet 1 Range C3
End If
I then need to be able to do this is reverse (upload)
This is only a small sample and I appreciate that I might need to introduce some sequential naming protocol to the textboxes.
Is there some way to code in a way that means that I will not need to insert a line of code for each textbox name into the code (there could be over 50 such textboxes and maybe 8 possible IF conditions).
I appreciate this is not the correct syntax and I can handle the code to search different worksheets should that be necessary, I am hoping that I can drastically reduce the number of lines of code.
Many thanks
Example
Command = Call Data (Via a Command Button in a User Form)
If Criteria value = A Then
TextBox1.Value = Sheet 1 Range A1
TextBox2.Value = Sheet 1 Range A2
TextBox3.Value = Sheet 1 Range A3
TextBox3.Value = Sheet 1 Range B1
TextBox5.Value = Sheet 1 Range B2
TextBox6.Value = Sheet 1 Range B3
TextBox7.Value = Sheet 1 Range C1
TextBox8.Value = Sheet 1 Range C2
TextBox9.Value = Sheet 1 Range C3
End If
If Criteria value = B Then
TextBox1.Value = Sheet 1 Range D1
TextBox2.Value = Sheet 1 Range D2
TextBox3.Value = Sheet 1 Range D3
TextBox3.Value = Sheet 1 Range E1
TextBox5.Value = Sheet 1 Range E2
TextBox6.Value = Sheet 1 Range E3
TextBox7.Value = Sheet 1 Range F1
TextBox8.Value = Sheet 1 Range F2
TextBox9.Value = Sheet 1 Range C3
End If
I then need to be able to do this is reverse (upload)
This is only a small sample and I appreciate that I might need to introduce some sequential naming protocol to the textboxes.
Is there some way to code in a way that means that I will not need to insert a line of code for each textbox name into the code (there could be over 50 such textboxes and maybe 8 possible IF conditions).
I appreciate this is not the correct syntax and I can handle the code to search different worksheets should that be necessary, I am hoping that I can drastically reduce the number of lines of code.
Many thanks