I made some progress, now I'm trying to load values in combobox.
Sub ssss_Initialize
Dim cPart As Range
Dim cParts As Range
Dim ws As Worksheet
Set ws = Worksheets("Inventory")
Set cParts = Rangem(Range("b5"))
With ws
For Each cPart In cParts
locations.AddItem cPart.Value
.List(.ListCount - 1, 1) = cPart.Offset(0, 1).Value
End Sub
Function Rangem(RefCell As Range) As Range
Dim prima As Range, ultima As Range
With RefCell.Parent
Set prima = .Cells(5, RefCell.Column)
If IsEmpty(prima) Then Set prima = prima.End(xlDown)
If prima.Address = .Cells(Rows.Count, RefCell.Column).Address Then
Set Rangem = Nothing
Else
Set ultima = .Cells(Rows.Count, RefCell.Column).End(xlUp)
Set Rangem = Range(prima, ultima)
End If
End With
End Function
The form adds data if I input a location manually but I get this error: "Method or data member not found" - for
.List(.ListCount - 1, 1) = cPart.Offset(0, 1).Value
. Anyone has any idea what I'm doing wrong?
Bookmarks