|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 转换()
Dim i, j, k, m
Dim irow
Dim arr, brr
irow = Sheet1.[a65336].End(xlUp).Row
arr = Sheet1.Range("a1:e" & irow)
Sheet1.Range("b3:b100").Clear
Sheet1.Cells(irow - 1, 4).Resize(20, 1).Clear
ReDim brr(1 To irow - 4, 1 To 1)
For i = 3 To irow - 2
arr(i, 5) = Application.WorksheetFunction.Substitute(arr(i, 1), ".", "/")
j = j + 1
If Len(arr(i, 5)) <= 5 Then
brr(j, 1) = "2024/" & arr(i, 5)
Else
If Len(arr(i, 5)) > 10 Then
brr(j, 1) = ""
Else
brr(j, 1) = arr(i, 5)
End If
End If
If brr(j, 1) < #10/20/2024# Then
k = k + arr(i, 4)
Else
m = m + arr(i, 4)
End If
Next
Sheet1.[b3].Resize(UBound(brr), 1) = brr
Sheet1.Cells(irow - 1, 4) = k
Sheet1.Cells(irow, 4) = m
End Sub |
|