akim
New Member
- Joined
- Jul 14, 2022
- Messages
- 5
- Office Version
- 365
- Platform
- Windows
Hi everyone,
this is my first post, so apologies if I make any mistake in posting here. I have been browsing through the forum and found some similar threads but none that really matched my problematic.
I am currently managing the stock and dispatches for the company I work for.
In my inventory sheet I have 3 columns :
- product name
- batch number
- quantity available for each batch
I created a little tailor made search engine with two dropdown lists on the spreadsheet to prepare my dispatches.
Step 1 : you select the product ; only products that are in stock show up in the list (those that have a balance of 0 do not appear)
Step 2 : you select the batch based on the previously selected product ; only batches that are in stock show up in the list (those that have a balance = 0 do not appear)
Here are two pictures to illustrate : first I select the product, then I select the batch. notice that values that have 0 kg in stock do not show up in any of the lists.
In order to automate the process of creating a dispatch and make it more user-friendly, I want to transcribe this process into a Userform in VBA with ComboBoxes.
At this point I have managed to show the available products in CboMaterial, however I am hitting a wall when it comes to create the dependent dropdown list with the corresponding batches available.
Here is my code so far :
It works fine so far, but I cannot repeat this process for CboBatch with the corresponding batches.
I tried inserting this formula
in the Rowsource section of properties of CboBatch, but it returns an error (RowSource seems to only take ranges...)
Does anyone have an idea how to do it ?
Many thanks in advance for your help !
Akim
this is my first post, so apologies if I make any mistake in posting here. I have been browsing through the forum and found some similar threads but none that really matched my problematic.
I am currently managing the stock and dispatches for the company I work for.
In my inventory sheet I have 3 columns :
- product name
- batch number
- quantity available for each batch
I created a little tailor made search engine with two dropdown lists on the spreadsheet to prepare my dispatches.
Step 1 : you select the product ; only products that are in stock show up in the list (those that have a balance of 0 do not appear)
Step 2 : you select the batch based on the previously selected product ; only batches that are in stock show up in the list (those that have a balance = 0 do not appear)
Here are two pictures to illustrate : first I select the product, then I select the batch. notice that values that have 0 kg in stock do not show up in any of the lists.
In order to automate the process of creating a dispatch and make it more user-friendly, I want to transcribe this process into a Userform in VBA with ComboBoxes.
At this point I have managed to show the available products in CboMaterial, however I am hitting a wall when it comes to create the dependent dropdown list with the corresponding batches available.
Here is my code so far :
VBA Code:
Sub UserForm_Initialize()
Dim ws_bl As Worksheet
Set ws_bl = Worksheets("Sheet1")
For Each cLoc In ws_bl.Range("filtered_products#")
With Me.cboMaterial
.AddItem cLoc.Value
End With
Next cLoc
End Sub
It works fine so far, but I cannot repeat this process for CboBatch with the corresponding batches.
I tried inserting this formula
VBA Code:
:="=FILTER(batch,(product=" & CboProduct.Value & ")*(balance<>0)"
Does anyone have an idea how to do it ?
Many thanks in advance for your help !
Akim