|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub test0()
- Dim data, results() As Long
- Dim i As Long, j As Long, k As Long, p As Long, x As Long
- Sheet2.Activate
- x = Range("AY3").Value + 2
- k = -Int(-35 / x)
- data = Range("C4:G4", Range("C4:G4").End(xlDown)).Value
- ReDim results(1 To UBound(data), 1 To 7)
- For i = 1 To UBound(data)
- For j = 1 To UBound(data, 2)
- p = -Int(-data(i, j) / k)
- If x = 3 Then If data(i, j) = 24 Then p = 3
- results(i, p) = results(i, p) + 1
- Next
- Next
- With Range("AZ4").Resize(UBound(results), UBound(results, 2)) '自行 改为 Range("AQ4")
- .ClearContents
- .Resize(, x).Value = results
- End With
- Beep
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|