本帖最后由 ykcbf1100 于 2024-5-2 07:53 编辑
更新一下,刚才代码有误。
- Sub ykcbf() '//2024.5.2
- r = Cells(Rows.Count, 2).End(3).Row
- arr = [a1].Resize(r, 12)
- For i = 3 To UBound(arr)
- st = "1.00"
- For j = 2 To 7
- If arr(i, j) <> "/" Then
- st = st & ":" & Round(arr(i, j) / arr(i, 1), 2)
- End If
- Next
- For j = 8 To 11
- If arr(i, j) <> "/" Then
- st = st & ":" & Round(arr(i, j) / arr(i, 1), 3)
- End If
- Next
- st = st & ":" & Round(arr(i, 11) / arr(i, 1), 2)
- arr(i, 12) = st
- Next
-
- [l1].Resize(r, 1) = Application.Index(arr, 0, 12)
- MsgBox "OK!"
- End Sub
复制代码
|