Croix automatique sous excel mac 2011

anthony -  
f894009 Messages postés 17417 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,
j'ai trouvé cette formule sous ce forum, mais je n'arrive pas à l'adapter :

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Target, Range("C9:D9,G9:H9")) Is Nothing Then: Exit Sub
If ActiveCell = "" Then
ActiveCell = "X"
ActiveCell.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
Else
ActiveCell = ""
End If
End Sub

J'ai 2 ordinateurs

1 Pc windows 7 avec excel 2007, et quand je copie cette formule je n'arrive pas à modifier les céllules ou je veux que la croix se mette en double click :
Plage de céllule que j'aimerais
G6:G16
G21:G36
G40:G50

Voila pour mon pc.

Je viens également d'acheter un mac avec excel 2011 et là rien ne se passe quand je copie la formule alors que sur mon pc je peux mettre les croix sur les céllules choisies dans la formule (C9, D9, G9, H9)

Merci

A voir également:

1 réponse

f894009 Messages postés 17417 Date d'inscription   Statut Membre Dernière intervention   1 715
 
Bonjour,

Essayez cela,

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  If Not Intersect(Target, Range("G6:G16,G21:G36,G40:G50")) Is Nothing Then
    Cancel = True
    If Target = "" Then
      With Target
        .Value = "X"
        .Font.Bold = True
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
      End With
    Else
      Target = ""
    End If
  End If
End Sub
0