|
Sub limonet()
Application.ScreenUpdating = False
Dim Arr As Variant, i%, Brr As Variant, Path$, FileName$
Path = ThisWorkbook.Path & "\"
FileName = Dir(Path & "*.xlsb")
Do While FileName <> ""
Workbooks.Open Path & FileName
i = Range("M1048576").End(xlUp).Row
Arr = Range("M1:P" & i).Value
ReDim Brr(1 To i, 1 To 3)
For i = 2 To i Step 3
Brr(i, 1) = Arr(i - 1, 1) - Arr(i, 1)
Brr(i, 2) = Arr(i - 1, 2) - Arr(i, 2)
Brr(i, 3) = Arr(i - 1, 4) - Arr(i, 4)
Next i
Range("U1").Resize(i - 3, 3) = Brr
ActiveWorkbook.Close True
FileName = Dir
Loop
Application.ScreenUpdating = True
End Sub
|
|