Ich möchte wenn ich auf "M2" einen Doppelklick mache,das der Blattschutz aufgehoben wird.
Dann das makro laufen lassen und dann den Blattschutz wieder setzen.
Könnte mir dabei Bitte jemand helfen.
Danke & Gruss, Heinz
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Address(0, 0) = "M2" Then
Cancel = True
Dim l!, t!, l1!, t1!
Application.ScreenUpdating = False
For x = 2 To 40
For y = 8 To 19
For z = 8 To 19
If Cells(y, x) = "x" And Cells(z, x + 1) = "x" Then
With Cells(y, x)
l = .Left + (.Width / 2)
t = .Top + (.Height / 2)
End With
With Cells(z, x + 1)
l1 = .Left + (.Width / 2)
t1 = .Top + (.Height / 2)
End With
With ActiveSheet.Shapes.AddLine(l, t, l1, t1).Line
.Weight = 2#
.ForeColor.RGB = RGB(255, 55, 55)
End With
End If
Next z
Next y
Next x
Application.ScreenUpdating = True
End If
End Sub