OVH Cloud OVH Cloud

ERREURE

11 réponses
Avatar
GARAULT
Private Sub Worksheet_Change(ByVal Target As Range)
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à sélectionner une
option dans la colonne suivante."
End Sub

Comment éviter que ce prog. n'agisse sur toute mes listes ?

10 réponses

1 2
Avatar
JLuc
GARAULT avait soumis l'idée :
Private Sub Worksheet_Change(ByVal Target As Range)
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à sélectionner une
option dans la colonne suivante."
End Sub

Comment éviter que ce prog. n'agisse sur toute mes listes ?


If Not Intersect(Target, Range("D11")) Is Nothing Then
...
...
Ca permet de tester la cellule qui a changer (Target)

--
JLuc

Avatar
GARAULT
comme ça ?

Private Sub Worksheet_Change(ByVal Target As Range)
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à sélectionner une
option dans la colonne suivante."

End Sub
If Not Intersect(Target, Range("D11")) Is Nothing Then


GARAULT avait soumis l'idée :
Private Sub Worksheet_Change(ByVal Target As Range)
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à sélectionner une
option dans la colonne suivante."
End Sub

Comment éviter que ce prog. n'agisse sur toute mes listes ?


If Not Intersect(Target, Range("D11")) Is Nothing Then
...
...
Ca permet de tester la cellule qui a changer (Target)

--
JLuc






Avatar
JLuc
GARAULT avait soumis l'idée :
comme ça ?
Non



Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous _
oblige à sélectionner une option dans la colonne suivante."
End If
End Sub

--
JLuc

Avatar
GARAULT
Et si maintenant je souhaite y ajouter le même type de message mais pour une
autre cellule et un message différent.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à sélectionner
une option dans la colonne suivante."
End If
End Sub




GARAULT avait soumis l'idée :
comme ça ?
Non



Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous _
oblige à sélectionner une option dans la colonne suivante."
End If
End Sub

--
JLuc






Avatar
JLuc
GARAULT avait soumis l'idée :
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à _
sélectionner une option dans la colonne suivante."
End If
If Not Intersect(Target, Range("Ta cellule")) Is Nothing Then
...
End If
End Sub

--
JLuc
Avatar
GARAULT
comment dire dans cette formule [s23 s112] que if [e11]= de s23 à s112 Then
MsgBox "Attention. Penssez à sélectionner une option dans la colonne suivante
pour composer entièrement votre ensemble."
End If
End Sub




Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à sélectionner
une option dans la colonne suivante."
End If
If Not Intersect(Target, Range("e11")) Is Nothing Then
If [e11] = [s23 s112] Then MsgBox "Attention. Penssez à sélectionner une
option dans la colonne suivante pour composer entièrement votre ensemble."
End If
End Sub





GARAULT avait soumis l'idée :
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à _
sélectionner une option dans la colonne suivante."
End If
If Not Intersect(Target, Range("Ta cellule")) Is Nothing Then
...
End If
End Sub

--
JLuc





Avatar
JLuc
GARAULT avait soumis l'idée :
comment dire dans cette formule [s23 s112] que if [e11]= de s23 à s112 Then
MsgBox "Attention. Penssez à sélectionner une option dans la colonne suivante
pour composer entièrement votre ensemble."
End If
End Sub




Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à sélectionner
une option dans la colonne suivante."
End If
If Not Intersect(Target, Range("e11")) Is Nothing Then
If [e11] = [s23 s112] Then MsgBox "Attention. Penssez à sélectionner une
option dans la colonne suivante pour composer entièrement votre ensemble."
End If
End Sub


If Not Intersect(Target, Range("E11")) Is Nothing Then
Flag = False
For x = 23 To 112
If Target = Cells(x, 19) Then
Flage = True
End If
Next
If Flag Then MsgBox "Ton message"
End If

--
JLuc

Avatar
GARAULT
sa me met un message d'erreur:

erreur de compilation
seuls des commentaires peuvent apparaitre apres endsub, end fonction, ou end
property

voici la formule:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à sélectionner une
option dans la colonne suivante."
End If

If Not Intersect(Target, Range("e11")) Is Nothing Then
If [e11] = [s23 s112] Then MsgBox "Attention. Penssez à sélectionner une
option dans la colonne suivante pour composer entièrement votre ensemble."
End If
End Sub

If Not Intersect(Target, Range("E11")) Is Nothing Then
Flag = False
For x = 23 To 112
If Target = Cells(x, 19) Then
Flage = True
End If
Next
If Flag Then MsgBox "Ton message"
End If








GARAULT avait soumis l'idée :
comment dire dans cette formule [s23 s112] que if [e11]= de s23 à s112 Then
MsgBox "Attention. Penssez à sélectionner une option dans la colonne suivante
pour composer entièrement votre ensemble."
End If
End Sub




Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à sélectionner
une option dans la colonne suivante."
End If
If Not Intersect(Target, Range("e11")) Is Nothing Then
If [e11] = [s23 s112] Then MsgBox "Attention. Penssez à sélectionner une
option dans la colonne suivante pour composer entièrement votre ensemble."
End If
End Sub


If Not Intersect(Target, Range("E11")) Is Nothing Then
Flag = False
For x = 23 To 112
If Target = Cells(x, 19) Then
Flage = True
End If
Next
If Flag Then MsgBox "Ton message"
End If

--
JLuc






Avatar
JLuc
Et oui, il faut y mettre *dans* la procédure, pas à coté :/

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à
sélectionner une
option dans la colonne suivante."
End If

If Not Intersect(Target, Range("E11")) Is Nothing Then
Flag = False
For x = 23 To 112
If Target = Cells(x, 19) Then
Flage = True
End If
Next
If Flag Then MsgBox "Ton message"
End If

End Sub



GARAULT avait soumis l'idée :
sa me met un message d'erreur:

erreur de compilation
seuls des commentaires peuvent apparaitre apres endsub, end fonction, ou end
property

voici la formule:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à sélectionner une
option dans la colonne suivante."
End If

If Not Intersect(Target, Range("e11")) Is Nothing Then
If [e11] = [s23 s112] Then MsgBox "Attention. Penssez à sélectionner une
option dans la colonne suivante pour composer entièrement votre ensemble."
End If
End Sub

If Not Intersect(Target, Range("E11")) Is Nothing Then
Flag = False
For x = 23 To 112
If Target = Cells(x, 19) Then
Flage = True
End If
Next
If Flag Then MsgBox "Ton message"
End If








GARAULT avait soumis l'idée :
comment dire dans cette formule [s23 s112] que if [e11]= de s23 à s112 Then
MsgBox "Attention. Penssez à sélectionner une option dans la colonne
suivante pour composer entièrement votre ensemble."
End If
End Sub




Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à
sélectionner une option dans la colonne suivante."
End If
If Not Intersect(Target, Range("e11")) Is Nothing Then
If [e11] = [s23 s112] Then MsgBox "Attention. Penssez à sélectionner une
option dans la colonne suivante pour composer entièrement votre ensemble."
End If
End Sub


If Not Intersect(Target, Range("E11")) Is Nothing Then
Flag = False
For x = 23 To 112
If Target = Cells(x, 19) Then
Flage = True
End If
Next
If Flag Then MsgBox "Ton message"
End If

--
JLuc






--
JLuc



Avatar
GARAULT
sa fonctionne pas


Et oui, il faut y mettre *dans* la procédure, pas à coté :/

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à
sélectionner une
option dans la colonne suivante."
End If

If Not Intersect(Target, Range("E11")) Is Nothing Then
Flag = False
For x = 23 To 112
If Target = Cells(x, 19) Then
Flage = True
End If
Next
If Flag Then MsgBox "Ton message"
End If

End Sub



GARAULT avait soumis l'idée :
sa me met un message d'erreur:

erreur de compilation
seuls des commentaires peuvent apparaitre apres endsub, end fonction, ou end
property

voici la formule:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à sélectionner une
option dans la colonne suivante."
End If

If Not Intersect(Target, Range("e11")) Is Nothing Then
If [e11] = [s23 s112] Then MsgBox "Attention. Penssez à sélectionner une
option dans la colonne suivante pour composer entièrement votre ensemble."
End If
End Sub

If Not Intersect(Target, Range("E11")) Is Nothing Then
Flag = False
For x = 23 To 112
If Target = Cells(x, 19) Then
Flage = True
End If
Next
If Flag Then MsgBox "Ton message"
End If








GARAULT avait soumis l'idée :
comment dire dans cette formule [s23 s112] que if [e11]= de s23 à s112 Then
MsgBox "Attention. Penssez à sélectionner une option dans la colonne
suivante pour composer entièrement votre ensemble."
End If
End Sub




Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à
sélectionner une option dans la colonne suivante."
End If
If Not Intersect(Target, Range("e11")) Is Nothing Then
If [e11] = [s23 s112] Then MsgBox "Attention. Penssez à sélectionner une
option dans la colonne suivante pour composer entièrement votre ensemble."
End If
End Sub


If Not Intersect(Target, Range("E11")) Is Nothing Then
Flag = False
For x = 23 To 112
If Target = Cells(x, 19) Then
Flage = True
End If
Next
If Flag Then MsgBox "Ton message"
End If

--
JLuc






--
JLuc








1 2