Deutsch
Germany.ruФорумы → Архив Досок→ Программирование

Вопрос по Excel.

10.07.20 14:45
Re: Вопрос по Excel.
 
NightWatch коренной житель
NightWatch
в ответ AURA2 10.07.20 12:54, Последний раз изменено 10.07.20 15:20 (NightWatch)
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim opdCell As Range
    Dim accuCell As Range
    Dim val As Variant
    
    With Tabelle1
        Set opdCell = .Range("B1")
        If Not Application.Intersect(opdCell, .Range(Target.Address)) Is Nothing And Application.IsNumber(opdCell.Value) Then
            If opdCell.Value <> 0 Then
                val = 0
                Set accuCell = .Range("A1")
                If Application.IsNumber(accuCell.Value) Then
                    val = accuCell.Value
                End If
                accuCell.Value = val + opdCell.Value
                opdCell.Value = 0
            End If
        End If
    End With
    
End Sub
 

Перейти на