Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Re: macro evenement change - PLAGE ? JpPradier

4 réponses
Avatar
Michel PICHOU
Bonjour, et merci pour ta réponse.
JpPradier a écrit :
- If Not Intersect(Range("B5:M5"), Target) Is Nothing Then ...
Je rappelle: je suis novice. Ai-je bien compris ?
Cette instruction signifie : S'il n'y a pas intersection entre "B5:M5"
et Target, alors l'instruction signifie d'oublier (Is Nothing) ce qui
précède, sinon Then... suite de la Sub.
Mais alors pourquoi ne pas faire :
- If Intersect(Range("B5:M5"), Target) Then ...
Je ne vois pas la différence.
Excuse-moi d'être "collant" !
Merci encore. Michel PICHOU

4 réponses

Avatar
anonymousA
regarde l'exemple suivant tiré de l'aide d'Excel: l

Worksheets("Sheet1").Activate
Set isect = Application.Intersect(Range("rg1"), Range("rg2"))
If isect Is Nothing Then
MsgBox "Ranges do not intersect"
Else
isect.Select
End If


Bonjour, et merci pour ta réponse.
- If Not Intersect(Range("B5:M5"), Target) Is Nothing Then ...
Je rappelle: je suis novice. Ai-je bien compris ?
Cette instruction signifie : S'il n'y a pas intersection entre "B5:M5"
et Target, alors l'instruction signifie d'oublier (Is Nothing) ce qui
précède, sinon Then... suite de la Sub.
Mais alors pourquoi ne pas faire :
- If Intersect(Range("B5:M5"), Target) Then ...
Je ne vois pas la différence.
Excuse-moi d'être "collant" !
Merci encore. Michel PICHOU



Avatar
Frédéric Sigonneau
Bonjour,

Je ne vois pas le début de cette conversation, mais cette ligne de code :
If Not Intersect(Range("B5:M5"), Target) Is Nothing Then
signifie
Si l'intersection entre la plage B5:M5 et la cellule cible (Target) n'est pas
rien Alors
ou, en français,
Si la cellule cible appartient à la plage B5:M5 alors etc.

FS
---
Frédéric Sigonneau [MVP Excel - né un sans-culottide]
Gestions de temps, VBA pour Excel :
http://frederic.sigonneau.free.fr
Si votre question sur Excel est urgente, évitez ma bal !

Bonjour, et merci pour ta réponse.
- If Not Intersect(Range("B5:M5"), Target) Is Nothing Then ...
Je rappelle: je suis novice. Ai-je bien compris ?
Cette instruction signifie : S'il n'y a pas intersection entre "B5:M5"
et Target, alors l'instruction signifie d'oublier (Is Nothing) ce qui
précède, sinon Then... suite de la Sub.
Mais alors pourquoi ne pas faire :
- If Intersect(Range("B5:M5"), Target) Then ...
Je ne vois pas la différence.
Excuse-moi d'être "collant" !
Merci encore. Michel PICHOU


Avatar
isabelle
bonjour Michel,

Not Intersect(a, b) Is Nothing
appartient à l'intersection

Intersect(a, b) Is Nothing
n'appartient pas à l'intersection

isabelle


Bonjour, et merci pour ta réponse.
- If Not Intersect(Range("B5:M5"), Target) Is Nothing Then ...
Je rappelle: je suis novice. Ai-je bien compris ?
Cette instruction signifie : S'il n'y a pas intersection entre "B5:M5"
et Target, alors l'instruction signifie d'oublier (Is Nothing) ce qui
précède, sinon Then... suite de la Sub.
Mais alors pourquoi ne pas faire :
- If Intersect(Range("B5:M5"), Target) Then ...
Je ne vois pas la différence.
Excuse-moi d'être "collant" !
Merci encore. Michel PICHOU


Avatar
JpPradier
Bonsoir Michel

J'aurais du servir dans les carabiniers, moi : j'arrive après la bataille !
:-)
Je crois que je n'ai rien à ajouter aux réponses données.

j-p