Private Sub Worksheet_Change(ByVal Target As Range)
Sheets("Раунд1").Unprotect Password:="1148"
Dim a, iStr As Integer, i As Integer
If Not Intersect(Target, Range("J14, L14, AF14, AH14")) Is Nothing Then
a = Array(0, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 52, 54, 56)
If Target.Cells(1) <> "" Then
Application.EnableEvents = False
If Not Target.Comment Is Nothing Then Target = CInt(Target.Comment.Text & Target)
For i = LBound(a) To UBound(a)
If Target = a(i) Then Exit For
If iStr <> 1 Then iStr = InStr(1, a(i), Target)
Next
If i > UBound(a) Then
If iStr = 1 Then
If Target.Comment Is Nothing Then
Target.AddComment
With Target.Comment
.Visible = True
.Shape.Top = Target.Top - Target.Height
.Shape.Left = Target.Left
.Shape.Width = Target.Width
.Shape.Height = Target.Height
End With
End If
Target.Comment.Text CStr(Target.Value)
Target = ""
Else
If Not Target.Comment Is Nothing Then Target.Comment.Delete
Target = ""
End If
Else
If Not Target.Comment Is Nothing Then Target.Comment.Delete
End If
End If
End If
Application.EnableEvents = True
Sheets("Раунд1").Protect Password:="1148"
Sheets("Раунд1").Unprotect Password:="1148"
Dim a, iStr As Integer, i As Integer
If Not Intersect(Target, Range("J13, L13, AF13, AH13")) Is Nothing Then
a = Array(0, 2, 3, 4, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 60, 70, 80, 90, 100, 120, 140, 160, 180, 200)
If Target.Cells(1) <> "" Then
Application.EnableEvents = False
If Not Target.Comment Is Nothing Then Target = CInt(Target.Comment.Text & Target)
For i = LBound(a) To UBound(a)
If Target = a(i) Then Exit For
If iStr <> 1 Then iStr = InStr(1, a(i), Target)
Next
If i > UBound(a) Then
If iStr = 1 Then
If Target.Comment Is Nothing Then
Target.AddComment
With Target.Comment
.Visible = True
.Shape.Top = Target.Top - Target.Height
.Shape.Left = Target.Left
.Shape.Width = Target.Width
.Shape.Height = Target.Height
End With
End If
Target.Comment.Text CStr(Target.Value)
Target = ""
Else
If Not Target.Comment Is Nothing Then Target.Comment.Delete
Target = ""
End If
Else
If Not Target.Comment Is Nothing Then Target.Comment.Delete
End If
End If
End If
Application.EnableEvents = True
Sheets("Раунд1").Protect Password:="1148"
End Sub
|