VBA Excel: IF (N'EST PAS DANS...) THEN

Post Reply
Amex
Posts: 17
Joined: 05 Nov 2006, 01:16

VBA Excel: IF (N'EST PAS DANS...) THEN

Post by Amex »

Bonjour!
Je suis dans la grosse programmation d'un programme de gestion, et j'aimerais savoir comment je pourrais dire:

Si la valeur recherchée n'est pas dans la sélection, alors, MsgBox("Donnée inconnue")...

::> IF Range("A1").Value n'est pas dans Range("SÉLECTION") THEN...
End if

MERCI TELLEMENT!
rikwar
Posts: 5204
Joined: 24 Apr 2006, 23:57
Contact:

Post by rikwar »

peuetre quellcun peut vous aidée mais ici cest pas un forum de programmation VBA Excel: peuetre attendre une réponse d un membre qui fait de la programmation VBA Excel ou
allez ici http://www.developpez.net/forums/archiv ... f-664.html
Image Image
skippy
Posts: 1136
Joined: 25 Apr 2006, 08:05
Contact:

Post by skippy »

Peut-être ici mais, il faudrait spécifier si c'est pour des chiffres ou du texte.

Espérant que vous lisez l'anglais.

Bonne chance.
[i]Le cas échéant, merci d'ajouter la mention[/i][color=red] [b][RÉSOLU][/b][/color] [i]dans l'entête "Sujet" de votre[/i] [color=red][b]PREMIER[/b][/color][i] message.[/i]
Sisko
Posts: 1328
Joined: 24 Apr 2006, 20:01

Post by Sisko »

Essayer aussi le forum comment ca marche.net

J'ai déjà trouvé des réponses pour excel...

http://www.commentcamarche.net/
GoHabsGo
Posts: 171
Joined: 26 Apr 2006, 23:12

Post by GoHabsGo »

Bonjour,
j'ai trouvé ceci sur le site de Microsoft. Ça peut vous donner un très bon point de départ même si ce n'est pas exactement ce que vous recherchez.

http://support.microsoft.com/kb/89794

Dim Count As Integer
Dim Target As String
Dim Cell As Object
Dim N As Integer

Sub Target_Count()
Count = 0
Target = InputBox("character(s) to find?")
If Target = "" Then GoTo Done
For Each Cell In Selection
N = InStr(1, cell.Value, target)
While N <> 0
Count = count + 1
N = InStr(n + 1, cell.Value, target)
Wend
Next Cell
MsgBox count & " Occurrences of " & target
Done:
End Sub
P4 3.0Ghz HT, 1Go Ram, AiW 9600XT, Windows XP pro sp2.
Dell Inspiron 6400, Centrino duo T2300, 1Go Ram, ATI X1400 256Mb, Windows XP pro sp2.
Post Reply