|
楼主 |
发表于 2020-6-5 23:07
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Dim i, j, k, l As Integer
Dim arr
Dim arr1
j = Sheet1.Range("a65536").End(xlUp).Row
p = 0
For k = 2 To 9
rng2 = Sheet4.Range("b" & k)
For l = 5 To 27 Step 2
For i = 2 To j
ReDim arr(1 To i)
ReDim arr1(1 To i)
Dim m As Integer
rng1 = Sheet1.Range("j" & i)
rng3 = Sheet1.Range("l" & i)
If rng1 = rng2 And rng3 = Sheet4.Cells(1, l) Then
arr1(i) = Sheet1.Range("d" & i)
m = Application.WorksheetFunction.Min(arr1)
If arr1(i) < m Then
Sheet4.Cells(k, l) = arr1(i)
Else
Sheet4.Cells(k, l) = m
End If
End If
If rng1 = rng2 And rng3 = Sheet4.Cells(1, l) Then
arr(i) = Sheet1.Range("e" & i)
b = Application.WorksheetFunction.max(arr)
Sheet4.Cells(k, l + 1) = b
End If
Next
Next
Next
End Sub
这是我写的 代码 一月初始应该是1 实际做出来的是错的 后面2月 3月是对的 |
|