Solidworks中VBA二维数组按Thickness(tableData(i,5))排序失败求助
问题描述
我尝试依据Thickness(对应tableData(i,5))对二维数组tableData进行排序,这段代码在Excel中运行正常,但在SolidWorks中无法实现排序。经检查发现Excel与SolidWorks中的循环迭代存在差异,以下是我的代码:
Dim temp0 As Double, temp1 As String, temp2 As Double, temp3 As String, temp4 As Double, temp5 As Double For i = 0 To UBound(tableData, 1) - 1 For j = i + 1 To UBound(tableData, 1) If tableData(i, 5) < tableData(j, 5) Then ' kalınlık temp0 = tableData(j, 0) temp1 = tableData(j, 1) temp2 = tableData(j, 2) temp3 = tableData(j, 3) temp4 = tableData(j, 4) temp5 = tableData(j, 5) tableData(j, 0) = tableData(i, 0) tableData(j, 1) = tableData(i, 1) tableData(j, 2) = tableData(i, 2) tableData(j, 3) = tableData(i, 3) tableData(j, 4) = tableData(i, 4) tableData(j, 5) = tableData(i, 5) tableData(i, 0) = temp0 tableData(i, 1) = temp1 tableData(i, 2) = temp2 tableData(i, 3) = temp3 tableData(i, 4) = temp4 tableData(i, 5) = temp5 End If Next j Next i
相关截图:

内容的提问来源于stack exchange,提问作者mesyen
相关产品推荐
相关产品推荐

