в этом коде я хочу получить в час сумму выбранных штук, поэтому на моем листе исключений много строк, у меня есть код, но он суммируется недостаточно быстро, в столбце s задано длинное значение dd: mm: yyy &чч: мм: сс в столбце p заполняется набранными в это время единицами
aj2 до aj10 имеют часовое значение 5, 6, 7 и т. д. aj10 = 13 ak2 до ak10 - это числа, выбранные вв тот час
то же самое от al2 до al10 - это часовое значение 14, 15, 16 и т. д. al10 = 22 am2 до am10 - это единицы, отобранные в этот час
, также необходимо суммировать и проверитьчас шт. только видимые ячейки, в которых есть значения
код на данный момент у меня есть это решение VBA или отлично
у меня на данный момент написано VBA, но, как я сказал, недостаточно быстродля суммирования всего кода требуется долгий путь
Private Sub CheckBox6_Click()
If CheckBox6.Value = True Then
Dim lijnen As String
lijnen = "an15:an" & Range("s15").End(xlDown).Row
Application.ScreenUpdating = False
For Each cell In Range(lijnen).SpecialCells(xlCellTypeVisible)
If cell.Value <> "" Then
If Format(cell.Value, "hh") = Format(Range("aj2").Value, "hh") Then
Range("ak2").Value = Range("ak2").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("aj3").Value, "hh") Then
Range("ak3").Value = Range("ak3").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("aj4").Value, "hh") Then
Range("ak4").Value = Range("ak4").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("aj5").Value, "hh") Then
Range("ak5").Value = Range("ak5").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("aj6").Value, "hh") Then
Range("ak6").Value = Range("ak6").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("aj7").Value, "hh") Then
Range("ak7").Value = Range("ak7").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("aj8").Value, "hh") Then
Range("ak8").Value = Range("ak8").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("aj9").Value, "hh") Then
Range("ak9").Value = Range("ak9").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("aj10").Value, "hh") Then
Range("ak10").Value = Range("ak10").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("al2").Value, "hh") Then
Range("am2").Value = Range("am2").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("al3").Value, "hh") Then
Range("am3").Value = Range("am3").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("al4").Value, "hh") Then
Range("am4").Value = Range("am4").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("al5").Value, "hh") Then
Range("am5").Value = Range("am5").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("al6").Value, "hh") Then
Range("am6").Value = Range("am6").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("al7").Value, "hh") Then
Range("am7").Value = Range("am7").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("al8").Value, "hh") Then
Range("am8").Value = Range("am8").Value + Range("p" & cell.Row).Value
Else
If Format(cell.Value, "hh") = Format(Range("al9").Value, "hh") Then
Range("am9").Value = Range("am9").Value + Range("p" & cell.Row).Value
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 cell
End If
Application.ScreenUpdating = True
End Sub