Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("H9:H298")) Is Nothing Then Exit Sub
On Error GoTo Fine
Application.EnableEvents = False
Dim Nriga As Long
Nriga = Target.Row
If Nriga / 2 - Fix(Nriga / 2) = 0 Then
MsgBox " cella non abilitata allinserimento del valore"
Application.Undo
GoTo Fine
End If
If Cells(Nriga, 1) = "" Then
MsgBox "Nominativo non presente" & Chr(13) & Chr(13) & " Inserire nominativo"
Application.Undo
GoTo Fine
End If
Cells(Nriga + 1, "H") = Cells(Nriga + 1, "H") + Target.Value
Target = ""
Fine:
Application.EnableEvents = True
End Sub
Sub AzzeraBersagli()
Dim SiNo, Style
Style = vbYesNo + vbCritical + vbDefaultButton2
Application.EnableEvents = False
SiNo = MsgBox("Confermi Azzeramento dei bersagli", Style)
If SiNo = vbYes Then Range("H9:H298") = ""
Application.EnableEvents = True
End Sub
|