Si cellules sont vides

Résolu
jean300 Messages postés 382 Statut Membre -  
jean300 Messages postés 382 Statut Membre -
Bonjour,
Je fais ce code qui ne fonctionne pas, pouvez-vous e corriger svp
En vous remerciant
Private Sub Worksheet_Change(ByVal Target As Range)
    Application.EnableEvents = False
        If Range("b10") = 0 Or Range("c10") = 0 Or Range("b11") = 0 Or Range("c11") = 0 Or Range("b12") = 0 Or Range("c12") = 0 Then
        MsgBox "Vous devez inscrire au moins 3 noms"
    Application.EnableEvents = True
End If
End Sub


5 réponses

  1. M-12 Messages postés 1349 Statut Membre 285
     
    Bonjour

    Teste comme ceci
    Private Sub Worksheet_Change(ByVal Target As Range)
    Application.EnableEvents = False
    If Application.WorksheetFunction.CountBlank(Range("B10:C12")) > 3 Then
    MsgBox "Vous devez inscrire au moins 3 noms"
    End If
    Application.EnableEvents = True
    End Sub
    0
  2. jean300 Messages postés 382 Statut Membre 14
     
    Bonjour M-12
    De nouveau je te remercie, c'est impeccable
    Bonne journée
    0
  3. jean300 Messages postés 382 Statut Membre 14
     
    Re
    Petit problème, à l'ouverture du classeur, après le mot de passe, le Msgbox apparaît ...?
    0
  4. M-12 Messages postés 1349 Statut Membre 285
     
    Re,
    J'ai pas vu de mot de passe, mais teste avec ceci
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Application.Intersect(Target, Range("B10:C12")) Is Nothing Then
    Application.EnableEvents = False
    If Application.WorksheetFunction.CountBlank(Range("B10:C12")) > 3 Then
    MsgBox "Vous devez inscrire au moins 3 noms"
    End If
    Application.EnableEvents = True
    End If
    End Sub
    0
  5. Vous n’avez pas trouvé la réponse que vous recherchez ?

    Posez votre question
  6. jean300 Messages postés 382 Statut Membre 14
     
    Mes vifs remerciements M-12, c'est parfait
    0