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, how about something like this?

 

 

Dim oRow As Integer
Select Case Parameter("MODEL")
    Case "AA100": oRow = 3
    Case "AA110": oRow = 4
    Case "AA120": oRow = 5
    Case "BB100": oRow = 8
    Case "BB110": oRow = 9
    Case "BB120": oRow = 10
    'And so on for C...
End Select

MultiValue.List("SIZE-VALUES") = GoExcel.CellValues("filename.xls", "Sheet1", "B" & oRow, "E" & oRow)

 

BTW. I wouldn't do this task this way at all. I'll load all the values in first place and then work with them (because working with an excel table takes quite some time).

 

Maybe something like this:

 

Sub Main()
MultiValue.SetList("SIZE", "SIZE-AA", "SIZE-BB", "SIZE-CC")
Dim Row As Integer
Dim oMyValues As Variant
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 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 Variant, 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 Usb

 

 

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