Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Owner2229
in reply to: Anonymous

Hi, as I see now I had some errors in the code. This one below should be working. You muss have the folowing parameters in model:

SIZE

SIZE_VALUES

 

 

Sub Main()
    MultiValue.SetList("SIZE", "SIZE-AA", "SIZE-BB", "SIZE-CC")
    Dim Row As Integer
    Dim oMyValues(9, 5) As Object ' Set the range for values (9 rows, 5 columns)
    GoExcel.Open("filename.xls", "Sheet1")
    Row = 1
    For j = 3 To 5 ' Set the rows for AA... values
        GetValues(oMyValues, Row, j)
        Row = Row + 1
    Next
    For j = 8 To 10 ' Set the rows for BB... values
        GetValues(oMyValues, Row, j)
        Row = Row + 1
    Next
    For j = 13 To 15 ' Set the rows for CC... values
        GetValues(oMyValues, Row, j)
        Row = Row + 1
    Next
    GoExcel.Close
    Dim oModel As String
    oModel = Parameter("SIZE")
    Dim MyArrayList As New ArrayList
    For i = 1 To UBound(oMyValues, 1)
	If oMyValues(i, 1) = oModel Then
	    MyArrayList.Add(oMyValues(i, 2))
            MyArrayList.Add(oMyValues(i, 3))
            MyArrayList.Add(oMyValues(i, 4))
            MyArrayList.Add(oMyValues(i, 5))
        End If
    Next
    MultiValue.List("SIZE_VALUES") = MyArrayList
End Sub

Private Sub GetValues(oMyValues As Object, Row As Integer, j As Integer)
    oMyValues(Row, 1) = GoExcel.CellValue("A" & j)
    oMyValues(Row, 2) = GoExcel.CellValue("B" & j)
    oMyValues(Row, 3) = GoExcel.CellValue("C" & j)
    oMyValues(Row, 4) = GoExcel.CellValue("D" & j)
    oMyValues(Row, 5) = GoExcel.CellValue("E" & j)
End Sub 

 

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods