Shape inactif si cellules verrouillées

boulou

XLDnaute Occasionnel
De l'aide fortement appréciée de votre part. Merci.

Sur feuille 1 ("semestrielle 1"), mon shape devient inactif si entête et pied de page sont verrouillés comme en feuille 2.
Je ne veux avoir que les cellules de la plage b8:ad60 d'accessibles. le shape ne couvre que les colonnes c;h;m;r;w;ab.

Mon code est le suivant
Option Explicit


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Union(Range("c8:c60"), Range("h8:h60"), Range("m8:m60"), Range("r8:r60"), Range("w8:w60"), Range("ab8:ab60"))) Is Nothing Then Exit Sub

On Error Resume Next
If Target.Count = 1 And ActiveSheet.Shapes("monshape").Visible = True Then
If Err <> 0 Then creeShape
ActiveSheet.Shapes("monshape").Select
ActiveSheet.Shapes("monshape").Left = ActiveCell.Left
ActiveSheet.Shapes("monshape").Top = ActiveCell.Top + ActiveCell.Height + 3
Selection.Characters.Text = ActiveCell
ActiveCell.Select
End If
End Sub

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)


ActiveSheet.Shapes("monshape").Visible = Not ActiveSheet.Shapes("monshape").Visible
If ActiveSheet.Shapes("monshape").Visible Then
ActiveSheet.Shapes("monshape").Select
ActiveSheet.Shapes("monshape").Left = ActiveCell.Left
ActiveSheet.Shapes("monshape").Top = ActiveCell.Top + ActiveCell.Height + 3
Selection.Characters.Text = ActiveCell
ActiveCell.Select
End If
Cancel = True
End Sub

Sub creeShape()
'ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 1, 1, 180, 50).Select
'Selection.Font.Name = "Verdana"
'Selection.Font.Size = 13
'Selection.Name = "monshape"
'ActiveSheet.Shapes("monshape").Left = ActiveCell.Left
'ActiveSheet.Shapes("monshape").Top = ActiveCell.Top + ActiveCell.Height + 3
End Sub

Qui aurait une solution ? Avec tous mes remerciements.
 

Pièces jointes

  • Semestrielle_31.xlsm
    116.5 KB · Affichages: 31

Discussions similaires

Statistiques des forums

Discussions
312 330
Messages
2 087 337
Membres
103 524
dernier inscrit
Smile1813