Sub о_ч_д()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Application.DisplayStatusBar = False
Application.DisplayAlerts = False
m = 48 'номер строки для выгрузки результатов
iList = Array("ТАиИ", "ОППР", "ТПКиГС", "ЦВП", "ОЭЗСиКС", "ЛМиС", "ЦНиИО", "АТЦ", "КО", "ТО", "ХЦ", "ХЛ", "ТТЦ", "ЭлТех", "ОТ") 'перечень листов
For Each el In iList
If sheetExists(el) Then
Sheets(el).Select
End If
k = 4 'номер столбца для выгрузки результатов
For j = 32 To 54 Step 2 'двенадцать проходов по столбцам по каждому листу
x1 = 0 'обнуляем, иначе при следующем проходе будет не верный результат
x2 = 0
x3 = 0
x4 = 0
x5 = 0
x6 = 0
x7 = 0
x8 = 0
x9 = 0
x10 = 0
x11 = 0
x12 = 0
x13 = 0
x14 = 0
x15 = 0
x16 = 0
x17 = 0
x18 = 0
x19 = 0
x20 = 0
x21 = 0
x22 = 0
x23 = 0
x24 = 0
x25 = 0
x26 = 0
x27 = 0
x28 = 0
x29 = 0
x30 = 0
x31 = 0
x32 = 0
x33 = 0
x34 = 0
x35 = 0
x36 = 0
x37 = 0
x38 = 0
x39 = 0
x40 = 0
y1 = 0
y2 = 0
y3 = 0
y4 = 0
y5 = 0
y6 = 0
y7 = 0
y8 = 0
y9 = 0
y10 = 0
y11 = 0
y12 = 0
y13 = 0
y14 = 0
y15 = 0
y16 = 0
y17 = 0
y18 = 0
y19 = 0
y20 = 0
y21 = 0
y22 = 0
y23 = 0
y24 = 0
y25 = 0
y26 = 0
y27 = 0
y28 = 0
y29 = 0
y30 = 0
y31 = 0
y32 = 0
y33 = 0
y34 = 0
y35 = 0
y36 = 0
y37 = 0
y38 = 0
y39 = 0
y40 = 0
c21 = 0
c22 = 0
c23 = 0
c24 = 0
c25 = 0
c26 = 0
c27 = 0
c28 = 0
c29 = 0
c30 = 0
c31 = 0
c32 = 0
c33 = 0
c34 = 0
c35 = 0
c36 = 0
c37 = 0
c38 = 0
c39 = 0
c40 = 0
a1 = 0
a2 = 0
a3 = 0
a4 = 0
a5 = 0
a6 = 0
a7 = 0
a8 = 0
a9 = 0
a10 = 0
a11 = 0
a12 = 0
a13 = 0
a14 = 0
a15 = 0
a16 = 0
a17 = 0
a18 = 0
a19 = 0
a20 = 0
a21 = 0
a22 = 0
a23 = 0
a24 = 0
a25 = 0
a26 = 0
a27 = 0
a28 = 0
a29 = 0
a30 = 0
a31 = 0
a32 = 0
a33 = 0
a34 = 0
a35 = 0
a36 = 0
a37 = 0
a38 = 0
a39 = 0
a40 = 0
b1 = 0
b2 = 0
b3 = 0
b4 = 0
b5 = 0
b6 = 0
b7 = 0
b8 = 0
b9 = 0
b10 = 0
b11 = 0
b12 = 0
b13 = 0
b14 = 0
b15 = 0
b16 = 0
b17 = 0
b18 = 0
b19 = 0
b20 = 0
b21 = 0
b22 = 0
b23 = 0
b24 = 0
b25 = 0
b26 = 0
b27 = 0
b28 = 0
b29 = 0
b30 = 0
b31 = 0
b32 = 0
b33 = 0
b34 = 0
b35 = 0
b36 = 0
b37 = 0
b38 = 0
b39 = 0
b40 = 0
d1 = 0
d2 = 0
d3 = 0
d4 = 0
d5 = 0
d6 = 0
d7 = 0
d8 = 0
d9 = 0
d10 = 0
d11 = 0
d12 = 0
d13 = 0
d14 = 0
d15 = 0
d16 = 0
d17 = 0
d18 = 0
d19 = 0
d20 = 0
d21 = 0
d22 = 0
d23 = 0
d24 = 0
d25 = 0
d26 = 0
d27 = 0
d28 = 0
d29 = 0
d30 = 0
d31 = 0
d32 = 0
d33 = 0
d34 = 0
d35 = 0
d36 = 0
d37 = 0
d38 = 0
d39 = 0
d40 = 0
lRow = Cells(Rows.Count, 2).End(xlUp).Row
For i = 15 To lRow 'суммирование значений, удовлетворяющих условиям
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ЦТОиПО" Then
a1 = Cells(i, j).Value
x1 = x1 + a1
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ЦТОиПО" Then
b1 = Cells(i, j).Value
y1 = y1 + b1
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ЦТОиПО" Then
a2 = Cells(i, j).Value
x2 = x2 + a2
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ЦТОиПО" Then
b2 = Cells(i, j).Value
y2 = y2 + b2
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ЦТОиПО" Then
a3 = Cells(i, j).Value
x3 = x3 + a3
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ЦТОиПО" Then
b3 = Cells(i, j).Value
y3 = y3 + b3
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ЦТОиПО" Then
a4 = Cells(i, j).Value
x4 = x4 + a4
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ЦТОиПО" Then
b4 = Cells(i, j).Value
y4 = y4 + b4
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ИЭСвп" Then
a5 = Cells(i, j).Value
x5 = x5 + a5
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ИЭСвп" Then
b5 = Cells(i, j).Value
y5 = y5 + b5
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ИЭСвп" Then
a6 = Cells(i, j).Value
x6 = x6 + a6
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ИЭСвп" Then
b6 = Cells(i, j).Value
y6 = y6 + b6
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ИЭСвп" Then
a7 = Cells(i, j).Value
x7 = x7 + a7
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ИЭСвп" Then
b7 = Cells(i, j).Value
y7 = y7 + b7
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ИЭСвп" Then
a8 = Cells(i, j).Value
x8 = x8 + a8
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ИЭСвп" Then
b8 = Cells(i, j).Value
y8 = y8 + b8
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ИЭСсп" Then
a9 = Cells(i, j).Value
x9 = x9 + a9
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ИЭСсп" Then
b9 = Cells(i, j).Value
y9 = y9 + b9
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ИЭСсп" Then
a10 = Cells(i, j).Value
x10 = x10 + a10
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ИЭСсп" Then
b10 = Cells(i, j).Value
y10 = y10 + b10
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ИЭСсп" Then
a11 = Cells(i, j).Value
x11 = x11 + a11
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ИЭСсп" Then
b11 = Cells(i, j).Value
y11 = y11 + b11
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ИЭСсп" Then
a12 = Cells(i, j).Value
x12 = x12 + a12
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ИЭСсп" Then
b12 = Cells(i, j).Value
y12 = y12 + b12
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ВП" Then
a13 = Cells(i, j).Value
x13 = x13 + a13
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ВП" Then
b13 = Cells(i, j).Value
y13 = y13 + b13
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ВП" Then
a14 = Cells(i, j).Value
x14 = x14 + a14
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ВП" Then
b14 = Cells(i, j).Value
y14 = y14 + b14
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ВП" Then
a15 = Cells(i, j).Value
x15 = x15 + a15
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ВП" Then
b15 = Cells(i, j).Value
y15 = y15 + b15
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ВП" Then
a16 = Cells(i, j).Value
x16 = x16 + a16
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ВП" Then
b16 = Cells(i, j).Value
y16 = y16 + b16
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ЛСЭ" Then
a17 = Cells(i, j).Value
x17 = x17 + a17
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ЛСЭ" Then
b17 = Cells(i, j).Value
y17 = y17 + b17
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ЛСЭ" Then
a18 = Cells(i, j).Value
x18 = x18 + a18
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ЛСЭ" Then
b18 = Cells(i, j).Value
y18 = y18 + b18
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ЛСЭ" Then
a19 = Cells(i, j).Value
x19 = x19 + a19
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ЛСЭ" Then
b19 = Cells(i, j).Value
y19 = y19 + b19
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ЛСЭ" Then
a20 = Cells(i, j).Value
x20 = x20 + a20
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "д" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ЛСЭ" Then
b20 = Cells(i, j).Value
y20 = y20 + b20
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ЦТОиПО" Then
a21 = Cells(i, j).Value
x21 = x21 + a21
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ЦТОиПО" Then
b21 = Cells(i, j).Value
y21 = y21 + b21
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ЦТОиПО" Then
c21 = Cells(i, j).Value
d21 = d21 + c21
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ЦТОиПО" Then
a22 = Cells(i, j).Value
x22 = x22 + a22
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ЦТОиПО" Then
b22 = Cells(i, j).Value
y22 = y22 + b22
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ЦТОиПО" Then
c22 = Cells(i, j).Value
d22 = d22 + c22
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ЦТОиПО" Then
a23 = Cells(i, j).Value
x23 = x23 + a23
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ЦТОиПО" Then
b23 = Cells(i, j).Value
y23 = y23 + b23
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ЦТОиПО" Then
c23 = Cells(i, j).Value
d23 = d23 + c23
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ЦТОиПО" Then
a24 = Cells(i, j).Value
x24 = x24 + a24
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ЦТОиПО" Then
b24 = Cells(i, j).Value
y24 = y24 + b24
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ЦТОиПО" Then
c24 = Cells(i, j).Value
d24 = d24 + c24
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ИЭСвп" Then
a25 = Cells(i, j).Value
x25 = x25 + a25
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ИЭСвп" Then
b25 = Cells(i, j).Value
y25 = y25 + b25
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ИЭСвп" Then
c25 = Cells(i, j).Value
d25 = d25 + c25
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ИЭСвп" Then
a26 = Cells(i, j).Value
x26 = x26 + a26
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ИЭСвп" Then
b26 = Cells(i, j).Value
y26 = y26 + b26
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ИЭСвп" Then
c26 = Cells(i, j).Value
d26 = d26 + c26
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ИЭСвп" Then
a27 = Cells(i, j).Value
x27 = x27 + a27
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ИЭСвп" Then
b27 = Cells(i, j).Value
y27 = y27 + b27
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ИЭСвп" Then
c27 = Cells(i, j).Value
d27 = d27 + c27
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ИЭСвп" Then
a28 = Cells(i, j).Value
x28 = x28 + a28
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ИЭСвп" Then
b28 = Cells(i, j).Value
y28 = y28 + b28
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ИЭСвп" Then
c28 = Cells(i, j).Value
d28 = d28 + c28
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ИЭСсп" Then
a29 = Cells(i, j).Value
x29 = x29 + a29
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ИЭСсп" Then
b29 = Cells(i, j).Value
y29 = y29 + b29
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ИЭСсп" Then
c29 = Cells(i, j).Value
d29 = d29 + c29
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ИЭСсп" Then
a30 = Cells(i, j).Value
x30 = x30 + a30
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ИЭСсп" Then
b30 = Cells(i, j).Value
y30 = y30 + b30
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ИЭСсп" Then
c30 = Cells(i, j).Value
d30 = d30 + c30
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ИЭСсп" Then
a31 = Cells(i, j).Value
x31 = x31 + a31
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ИЭСсп" Then
b31 = Cells(i, j).Value
y31 = y31 + b31
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ИЭСсп" Then
c31 = Cells(i, j).Value
d31 = d31 + c31
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ИЭСсп" Then
a32 = Cells(i, j).Value
x32 = x32 + a32
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ИЭСсп" Then
b32 = Cells(i, j).Value
y32 = y32 + b32
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ИЭСсп" Then
c32 = Cells(i, j).Value
d32 = d32 + c32
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ВП" Then
a33 = Cells(i, j).Value
x33 = x33 + a33
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ВП" Then
b33 = Cells(i, j).Value
y33 = y33 + b33
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ВП" Then
c33 = Cells(i, j).Value
d33 = d33 + c33
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ВП" Then
a34 = Cells(i, j).Value
x34 = x34 + a34
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ВП" Then
b34 = Cells(i, j).Value
y34 = y34 + b34
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ВП" Then
c34 = Cells(i, j).Value
d34 = d34 + c34
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ВП" Then
a35 = Cells(i, j).Value
x35 = x35 + a35
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ВП" Then
b35 = Cells(i, j).Value
y35 = y35 + b35
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ВП" Then
c35 = Cells(i, j).Value
d35 = d35 + c35
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ВП" Then
a36 = Cells(i, j).Value
x36 = x36 + a36
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ВП" Then
b36 = Cells(i, j).Value
y36 = y36 + b36
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ВП" Then
c36 = Cells(i, j).Value
d36 = d36 + c36
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ЛСЭ" Then
a37 = Cells(i, j).Value
x37 = x37 + a37
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ЛСЭ" Then
b37 = Cells(i, j).Value
y37 = y37 + b37
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "опд" And Cells(i, 24).Value = "ЛСЭ" Then
c37 = Cells(i, j).Value
d37 = d37 + c37
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ЛСЭ" Then
a38 = Cells(i, j).Value
x38 = x38 + a38
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ЛСЭ" Then
b38 = Cells(i, j).Value
y38 = y38 + b38
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "т2" And Cells(i, 24).Value = "ЛСЭ" Then
c38 = Cells(i, j).Value
d38 = d38 + c38
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ЛСЭ" Then
a39 = Cells(i, j).Value
x39 = x39 + a39
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ЛСЭ" Then
b39 = Cells(i, j).Value
y39 = y39 + b39
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "то" And Cells(i, 24).Value = "ЛСЭ" Then
c39 = Cells(i, j).Value
d39 = d39 + c39
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "*" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ЛСЭ" Then
a40 = Cells(i, j).Value
x40 = x40 + a40
Else
If Cells(i, 17).Value > 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ЛСЭ" Then
b40 = Cells(i, j).Value
y40 = y40 + b40
Else
If Cells(i, 17).Value = 0 And Cells(i, 18).Value > 0 And Cells(i + 2, 1).Value = "ч" And Cells(i, 28).Value = "ид" And Cells(i, 24).Value = "ЛСЭ" Then
c40 = Cells(i, j).Value
d40 = d40 + c40
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
Next
Z1 = 0 'обнуляем, иначе при следующем проходе будет не верный результат
Z2 = 0
Z3 = 0
Z4 = 0
Z5 = 0
Z6 = 0
Z7 = 0
Z8 = 0
Z9 = 0
Z10 = 0
Z11 = 0
Z12 = 0
Z13 = 0
Z14 = 0
Z15 = 0
Z16 = 0
Z17 = 0
Z18 = 0
Z19 = 0
Z20 = 0
Z21 = 0
Z22 = 0
Z23 = 0
Z24 = 0
Z25 = 0
Z26 = 0
Z27 = 0
Z28 = 0
Z29 = 0
Z30 = 0
Z31 = 0
Z32 = 0
Z33 = 0
Z34 = 0
Z35 = 0
Z36 = 0
Z37 = 0
Z38 = 0
Z39 = 0
Z40 = 0
Z1 = x1 + y1 'запоминаем полученные результаты
Z2 = x2 + y2
Z3 = x3 + y3
Z4 = x4 + y4
Z5 = x5 + y5
Z6 = x6 + y6
Z7 = x7 + y7
Z8 = x8 + y8
Z9 = x9 + y9
Z10 = x10 + y10
Z11 = x11 + y11
Z12 = x12 + y12
Z13 = x13 + y13
Z14 = x14 + y14
Z15 = x15 + y15
Z16 = x16 + y16
Z17 = x17 + y17
Z18 = x18 + y18
Z19 = x19 + y19
Z20 = x20 + y20
Z21 = x21 + y21 + d21
Z22 = x22 + y22 + d22
Z23 = x23 + y23 + d23
Z24 = x24 + y24 + d24
Z25 = x25 + y25 + d25
Z26 = x26 + y26 + d26
Z27 = x27 + y27 + d27
Z28 = x28 + y28 + d28
Z29 = x29 + y29 + d29
Z30 = x30 + y30 + d30
Z31 = x31 + y31 + d31
Z32 = x32 + y32 + d32
Z33 = x33 + y33 + d33
Z34 = x34 + y34 + d34
Z35 = x35 + y35 + d35
Z36 = x36 + y36 + d36
Z37 = x37 + y37 + d37
Z38 = x38 + y38 + d38
Z39 = x39 + y39 + d39
Z40 = x40 + y40 + d40
Sheets("Бюджет").Select
Cells(m, k).Value = Z1 'выгружаем полученные результаты
Cells(m + 1, k).Value = Z2
Cells(m + 2, k).Value = Z3
Cells(m + 3, k).Value = Z4
Cells(m + 4, k).Value = Z5
Cells(m + 5, k).Value = Z6
Cells(m + 6, k).Value = Z7
Cells(m + 7, k).Value = Z8
Cells(m + 8, k).Value = Z9
Cells(m + 9, k).Value = Z10
Cells(m + 10, k).Value = Z11
Cells(m + 11, k).Value = Z12
Cells(m + 12, k).Value = Z13
Cells(m + 13, k).Value = Z14
Cells(m + 14, k).Value = Z15
Cells(m + 15, k).Value = Z16
Cells(m + 16, k).Value = Z17
Cells(m + 17, k).Value = Z18
Cells(m + 18, k).Value = Z19
Cells(m + 19, k).Value = Z20
'пропускаем строку
Cells(m + 21, k).Value = Z21
Cells(m + 22, k).Value = Z22
Cells(m + 23, k).Value = Z23
Cells(m + 24, k).Value = Z24
Cells(m + 25, k).Value = Z25
Cells(m + 26, k).Value = Z26
Cells(m + 27, k).Value = Z27
Cells(m + 28, k).Value = Z28
Cells(m + 29, k).Value = Z29
Cells(m + 30, k).Value = Z30
Cells(m + 31, k).Value = Z31
Cells(m + 32, k).Value = Z32
Cells(m + 33, k).Value = Z33
Cells(m + 34, k).Value = Z34
Cells(m + 35, k).Value = Z35
Cells(m + 36, k).Value = Z36
Cells(m + 37, k).Value = Z37
Cells(m + 38, k).Value = Z38
Cells(m + 39, k).Value = Z39
Cells(m + 40, k).Value = Z40
k = k + 3
If j <> 54 Then
Sheets(el).Select
End If
Next
m = m + 44
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Application.DisplayStatusBar = True
Application.DisplayAlerts = True
End Sub
Public Function sheetExists(name As Variant) As Boolean
On Error GoTo notFound
test = ActiveWorkbook.Sheets(name).name
If test <> "" Then
sheetExists = True
Exit Function
End If
notFound:
sheetExists = False
End Function
|