Aktif Hücreye Sayı Yazıldıkça Üstüne Ekleyerek Topla - Microsoft Excel


Aktif hücreye sayı girişi yapıldıkça bu sayı hücredeki sayının üzerine eklenerek toplanır.

Kod


Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    
    On Error GoTo hata
    
    Application.EnableEvents = False
    
    If IsNumeric(Target.Value) Then
        If Not Target.Comment Is Nothing Then
            Target = Target.Value + CDbl(Target.Comment.Text)
            Target.Comment.Delete
        End If
        
        Target.AddComment (Target.Text)
        Application.DisplayCommentIndicator = 0
        Target.Select
    End If
    
hata:
    Application.EnableEvents = True
End Sub

Etiketler
microsoft excel microsoft excel vba microsoft excel vba matematik işlemleri