|
本帖最后由 taotu 于 2020-1-28 21:24 编辑
Function mil(col)
With ActiveSheet
l_r = .[b65536].End(xlUp).Row
l_c1 = .[a2].End(xlToRight).Column
changdu = (.[a2].End(xlToRight).Column - col + 1) / 2
For j1 = col To (col + changdu - 1)
For j2 = (col + changdu) To l_c1
l_c = .[a2].End(xlToRight).Column
.Cells.Replace what:="已使用", replacement:=""
shou = 1
ci_shu = 0
.Cells(2, l_c + 1) = .Cells(2, j1) & "第一" & .Cells(2, j2) & "第二"
For k = 3 To l_r
If .Cells(k, j1) <> "" And InStr(.Cells(.Cells(k, j2).End(xlDown).Row, j2), "已使用") = 0 And .Cells(.Cells(k, j2).End(xlDown).Row, j2) <> "" Then
shou= shou * .Cells(.Cells(k, j2).End(xlDown).Row, 5) / .Cells(k, 5)
ci_shu = ci_shu + 1
.Cells(.Cells(k, j2).End(xlDown).Row, j2) = .Cells(.Cells(k, j2).End(xlDown).Row, j2) & "已使用"
'.Cells(k, l_c + 1) = .Cells(.Cells(k, j2).End(xlDown).Row, 5) / .Cells(k, 5)
End If
Next
.Cells(3, l_c + 1) = shou
.Cells(4, l_c + 1) = ci_shu
Next
Next
End With
End Function
|
|