[xpost]
[/xpost]
Hi to all experts,
i have a file with multiple sheets with same format and it subtracts automatically C-D using vba and puts the answer E when i paste new data on it
What i want to do is apply this vba code to F-G=H and I-J=K and P-Q=R on each sheet but couldn't
I use this for consolidating datas which i get every month from branches and i just want to copy and paste whole sheet at once (not column by column) whitout controlling if there are any wrong formulas on it..
I couldnt attach my exact file but have a wetransfer link for it.
and
There is two code on each sheet, one is,
Code
Private Sub Worksheet_Change(ByVal Target As Range)
Dim LastRw As Long
LastRw = ListObjects(1).DataBodyRange.Rows.Count + 10 'Last table row + 10
If Not Intersect(Target, Range("C11:d" & LastRw)) Is Nothing Then
Call CminusO(LastRw)
End If
End Sub
second code is like that,
Code
Sub CminusO(LastRw As Long)
Dim LastE As Long
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
LastE = Cells(Rows.Count, "E").End(xlUp).Row
Range("e11:e" & LastE) = vbNullStr 'clear any stray E data below table if exists?
Range("e11:e" & LastRw) = Evaluate("C11:C" & LastRw & "-d11:d" & LastRw)
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
End Sub
Display More
Thanks a looottt in advance.
Best regards..