Сумма по 51 + классы DataCopy

Sub test_GET_SUM()
Dim DC As New DataCopy
Dim DC90 As New DataCopy90
Dim Format1 As New Format
Dim TotaRec As Integer

Application.ScreenUpdating = False

DC.SheetSelect ActiveSheet.Name, "Контрагент (приходы)"
ThisWorkbook.Sheets("Приходы").Select
Range(DC.KontrRow - 3 & ":" & DC.ObItog2Row).Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
totalRec = DC90.TotalRecords(DC.KontrRow + 1, DC.ObItog1Column)
Range(DC.KontrRow + 20 & ":" & DC.KontrRow + 20).Insert Shift:=xlDown
Range("A" & DC.KontrRow + 20) = "Прочие (" & totalRec - 19 & ")"
DC90.InserSum DC.KontrRow + 20, DC.KontrRow + 20 + 1, DC.ObItog2Row, DC.ObItog1Column
Format1.FontBold DC.KontrRow + 20, DC.ObItog1Column

S_to_del = DC.KontrRow + totalRec + 2
end_to_del = DC.ObItog2Row - 0
DC90.DelPatTable S_to_del, end_to_del


DC.SheetSelect ActiveSheet.Name, "Контрагент(расходы)"
ThisWorkbook.Sheets("Приходы").Select
Range(DC.KontrRow - 3 & ":" & DC.ObItog2Row).Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
totalRec = DC90.TotalRecords(DC.KontrRow + 3, DC.ObItog1Column)
Range(DC.KontrRow + 22 & ":" & DC.KontrRow + 22).Insert Shift:=xlDown
Range("A" & DC.KontrRow + 22) = "Прочие (" & totalRec - 19 & ")"
DC90.InserSum DC.KontrRow + 22, DC.KontrRow + 22 + 1, DC.ObItog2Row, DC.ObItog1Column
Format1.FontBold DC.KontrRow + 22, DC.ObItog1Column

S_to_del = DC.KontrRow + totalRec + 4
end_to_del = DC.ObItog2Row - 0
DC90.DelPatTable S_to_del, end_to_del



Set DC = Nothing
Set DC90 = Nothing



Application.ScreenUpdating = True
End Sub

Добавить комментарий

Ваш адрес email не будет опубликован.