Faire apparaître un message dans une fenêtre

CG29

XLDnaute Junior
Bonjour,

Je cherche à afficher un popup sur Excel si par exemple la cellule A1 est supérieur à 1 ou inférieur à -1,

Je n’ai pas réussi à trouver le code pour le faire,

Pouvez-vous m’aider,

Merci d’avance,

Christophe
 

tototiti2008

XLDnaute Barbatruc
Re : Faire apparaître un message dans une fenêtre

Bonjour CG29,

Bienvenue sur XLD,

Sélectionne A1

Menu Données - Validation

Autoriser : Personnalisé
Formule : =ABS(A1)<=1

Onglet Alerte d'erreur :
Style : Information
puis message du popup à droite

OK

Edit : Bing, Bonjour kjin ;)
 

BOISGONTIER

XLDnaute Barbatruc
Repose en paix
Re : Faire apparaître un message dans une fenêtre

Bonjour,

=affichecmt(A2;"or(A2<-1,A2>1";"Inf à -1 ou Sup à 1";3)

Code:
Function afficheCmt(cel, cond, msg, coul)
  Application.Volatile
  Set f = Sheets(Application.Caller.Parent.Name)
  temp = Evaluate(cond)
  If Not cel.Comment Is Nothing Then cel.Comment.Delete
  If temp Then
    With cel
     If .Comment Is Nothing Then .AddComment
     .Comment.Shape.Width = Len(msg) * 5
     .Comment.Shape.Height = 10
     .Comment.Shape.Left = .Left + .Width + 5
     .Comment.Shape.Top = .Top - 10
     .Comment.Visible = True
     .Comment.Text Text:=msg
     .Comment.Shape.Fill.ForeColor.SchemeColor = coul
    End With
  End If
  afficheCmt = ""
End Function

http://boisgontierjacques.free.fr/fichiers/Commentaires/CmtAffiche.xls

JB
 

Pièces jointes

  • FonctionCmtAffiche.xls
    30.5 KB · Affichages: 119
  • FonctionCmtAffiche2.xls
    30 KB · Affichages: 127
Dernière édition:

Discussions similaires

Statistiques des forums

Discussions
311 725
Messages
2 081 939
Membres
101 844
dernier inscrit
pktla