Im a very beginner with VBA. Ive got a scenario to decide the perfect way for binding and manipulate the data from different sheets in a custom form designed in another sheet on the same workbook.
There are 2 sheets one with Fruit names in different year and another with Quantity of every year.
Here is Sheet 1 data.
Based on this I need to bind these years to one dropdown, fruits to another dropdown (based on year it should load dynamically). Since my previous experience in .NET so if we consider all as a Datatable its easy to manipulate anything using some filters or just some loops or with LINQ. But in VBA how can we handle these bindings and manipulation based on these data. Also if the rows could not be always in specific cell ranges, there could be more. So how can we handle when dynamic data.
What I tried for binding is as follows based on this link
Dim vArr as Variant
Dim i as Integer
vArr = WorksheetFunction.Transpose(Sheets(2).Range("A2:A10").value)
With Sheets(1).OLEObjects("ComboBox1").Object
.Clear
For i = Lbound(vArr) to Ubound(vArr)
.AddItem vArr(i)
Next i
End With