Hi everyone,
Ive been struggling with this for 2 days now I could really use some help.
I have the following problem:
Ive got a sheet1 named "initial" in wich ive got a bunch of buttons that open up different userforms, before the user is able to press the buttons he must choose between 3 options, warehouse1, warehouse2, warehouse 3. Once his chosen either of this he can press any button that will show a userform.
One of the buttons opens Userform1, in which the user must type an IDNUMBER, this userform has a combobox that has to be populated with variable information depending on 2 things:
- The warehouse the user selected before clicking the button
- And the IDNumber the user typed
Depending on the warehouse he chosed in "initial" it will take the information from either of the following sheets:
"Batch numbers 1st", "Batch numbers 2nd", "Batch numbers 3rd".
Depending on what he types on the textbox, the combobox should populate from the range
with row= 2 through row="finalrow" and from column="initialcolumn".
I have already written the code to find every variable, however when i get the code to run, the combobox is empty.
BUT, when I replace the underlined part of the code with a normal range lets say "B4:B11", the code runs ok.
Problem is that the range will always be variable depending on what the user types in the textbox.
Do
column = column + 1
Loop Until Worksheets(WSnumber).Cells(1, column) = TextBox2
row = 1
Do
row = row + 1
Loop Until Worksheets(WSnumber).Cells(row + 1, column) = Empty
ComboBox1.List = Sheets("Batch Numbers " & Cells(3, 2)).Range(Cells(2, column), Cells(row, column)).Value
If i change that part to this:
ComboBox1.List = Sheets("Batch Numbers " & Cells(3, 2)).Range("B4:B11").Value
the code runs just fine, how ever i need the range to be variable.
Please ill appreciate any help, ive been stucked for 2 days now.
Ive been struggling with this for 2 days now I could really use some help.
I have the following problem:
Ive got a sheet1 named "initial" in wich ive got a bunch of buttons that open up different userforms, before the user is able to press the buttons he must choose between 3 options, warehouse1, warehouse2, warehouse 3. Once his chosen either of this he can press any button that will show a userform.
One of the buttons opens Userform1, in which the user must type an IDNUMBER, this userform has a combobox that has to be populated with variable information depending on 2 things:
- The warehouse the user selected before clicking the button
- And the IDNumber the user typed
Depending on the warehouse he chosed in "initial" it will take the information from either of the following sheets:
"Batch numbers 1st", "Batch numbers 2nd", "Batch numbers 3rd".
Depending on what he types on the textbox, the combobox should populate from the range
with row= 2 through row="finalrow" and from column="initialcolumn".
I have already written the code to find every variable, however when i get the code to run, the combobox is empty.
BUT, when I replace the underlined part of the code with a normal range lets say "B4:B11", the code runs ok.
Problem is that the range will always be variable depending on what the user types in the textbox.
Do
column = column + 1
Loop Until Worksheets(WSnumber).Cells(1, column) = TextBox2
row = 1
Do
row = row + 1
Loop Until Worksheets(WSnumber).Cells(row + 1, column) = Empty
ComboBox1.List = Sheets("Batch Numbers " & Cells(3, 2)).Range(Cells(2, column), Cells(row, column)).Value
If i change that part to this:
ComboBox1.List = Sheets("Batch Numbers " & Cells(3, 2)).Range("B4:B11").Value
the code runs just fine, how ever i need the range to be variable.
Please ill appreciate any help, ive been stucked for 2 days now.