|
楼主 |
发表于 2024-1-12 08:19
|
显示全部楼层
With Sheets(1)
m = .[b65536].End(3).Row
arr1 = .[a2].Resize(m - 1, 1)
arr3 = .[v2].Resize(m - 1, 1)
arr4 = .[x2].Resize(m - 1, 1)
arr5 = .[t2].Resize(m - 1, 1)
arr6 = .[h2].Resize(m - 1, 1)
arr7 = .[q2].Resize(m - 1, 1)
arr = .[O2].Resize(m - 1, 1)
arr8 = arr
ReDim arr2(1 To m - 1, 1 To 1)
For i = 1 To UBound(arr)
arr6(i, 1) = Replace(Replace(arr6(i, 1), ",", " "), "-", "")
ss6 = Split("1" & " " & arr6(i, 1), " ")
ss7 = Split("1" & " " & arr7(i, 1), " ")
For j = 1 To UBound(ss6)
If arr2(i, 1) < 0 Then
arr2(i, 1) = ss6(j) & ss7(j)
If arr8(i, 1) = "" Then arr(i, 1) = "'" & Format(arr3(i, 1), "yyyymmdd") & " " & ss6(j) & ss7(j)
Else
arr2(i, 1) = arr2(i, 1) & " " & ss6(j) & ss7(j)
If arr8(i, 1) = "" Then arr(i, 1) = arr(i, 1) & " " & Format(arr3(i, 1), "yyyymmdd") & " " & ss6(j) & ss7(j)
End If
If arr4(i, 1) = 1 Then
If arr8(i, 1) = "" Then arr(i, 1) = arr(i, 1) & " " & Format(arr3(i, 1), "yyyymmdd") & " " & arr1(i, 1)
End If
Next
arr5(i, 1) = DateSerial(Year(Now()) + Val(arr5(i, 1)), Month(Now()), Day(Now()))
Next
.[O2].Resize(m - 1, 1) = arr
.[v2].Resize(m - 1, 1) = arr5
.[s2].Resize(m - 1, 1) = arr2
End With
End Sub |
|