|
本帖最后由 一把小刀闯天下 于 2018-8-6 15:25 编辑
图表1.rar
(27.31 KB, 下载次数: 15)
Option Explicit
Sub test()
Dim shp, i, n
ReDim arr(1 To 33), brr(1 To 16)
With Sheets("图表")
For i = 1 To .Shapes.Count
If InStr(.Shapes(i).Name, "Check") = 1 Then
If .OLEObjects(.Shapes(i).Name).Object.Value Then
n = Val(Replace(.Shapes(i).Name, "CheckBox", vbNullString))
If n <= 33 Then
arr(n) = n
Else
brr(n - 33) = n - 33
End If
End If
End If
Next
Call dsort(arr): Call getdata(arr): .[c5].Resize(, UBound(arr)) = arr
Call dsort(brr): Call getdata(brr): .[c6].Resize(, UBound(brr)) = brr
End With
End Sub
Function getdata(arr)
Dim i, j, n
For i = 1 To UBound(arr)
If arr(i) > 0 Then
For j = i To UBound(arr)
n = n + 1: arr(n) = arr(j): arr(j) = vbNullString
Next
Exit Function
End If
Next
End Function
Function dsort(arr)
Dim i, j, t
For i = 1 To UBound(arr) - 1
For j = i + 1 To UBound(arr)
If arr(i) > arr(j) Then t = arr(i): arr(i) = arr(j): arr(j) = t
Next j, i
End Function |
评分
-
1
查看全部评分
-
|