|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Public Sub qs() '2024/7/6
Dim arr, sht As Worksheet
For Each sht In Sheets
If sht.Name <> "Sheet0" Then
arr = sht.Range("b1:e" & Sheet1.Cells(Rows.Count, 2).End(3).Row)
For i = 2 To UBound(arr)
If arr(i, 3) <> Empty And arr(i - 1, 3) <> Empty Then
arr(i, 4) = arr(i, 3) - arr(i - 1, 3)
End If
Next
With Sheet6
If .Range("b1") = "" Then
.Range("b1").Resize(UBound(arr), 4) = arr
Else
rw = .Cells(Rows.Count, "d").End(3).Row + 2
.Range("b" & rw).Resize(UBound(arr), 4) = arr
End If
End With
End If
Next
End Sub |
|