Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Sub SumBad()
Dim WK As Workbook
Dim WS As Worksheet
Dim Bad_Sum As Integer
Set WK = Excel.ActiveWorkbook
Set WS = WK.ActiveSheet
Bad_Sum = 0
' Перебор строк
For r = 2 To 7
' Перебор столбцов
For c = 6 To 8
If WS.Cells(r, c).Style = "Плохой" And IsNumeric(WS.Cells(r, c)) Then
Bad_Sum = Bad_Sum + WS.Cells(r, c)
End If
Next c
Next r
' Вывод результата
WS.Cells(9, 6) = Bad_Sum
End Sub
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question