|
|
|
|
Configuration: Windows XP Internet Explorer 6.0
essaie avec :
if Cell.Value >0 and Cell.Value <100 à la place de ton for. Knowledge is power.
|
if Cell.Value like *.* then...
là j'ai mis le point, mais si tu utilises la virgule, tu as juste à remplacer. Knowledge is power.
|
Au faite, je n'ai pas touché à mon "for", j'ai directement remplacé mon "If" par la ligne que tu m'a conseillé, voici le prog actuel :
Dim Cell As Range Dim x As Integer Dim y As Integer x = 7 For Each Cell In Range("c7:c1000") x = x + 1 If Cell.Value > 0 And Cell.Value < 100 Then Cell.Value = Cells(x, 4) Next Cell End Sub |
bonjour,
pour info : la syntaxe d'une boucle For ... Next est : For i = 0 to 99
a = a + i
Next i
Ici a = 100 à la fin de la boucle. ;o) polux
|
laisse la boucle for de coté, tu n'en as pas besoin pour ce que tu veux faire.
Knowledge is power.
|
meme avec des " ?
If Cell.Value like "*.*" then... Knowledge is power. |
Sub nom_que_tu_veux()
Dim Cell As Range Dim x As Integer x = 7 For Each Cell In Range("c7:c1000") If Cell.Value Like "*.*" Then Cell.Value = Cells(x, 4) x = x + 1 Next Cell End Sub et elle fonctionne. Knowledge is power.
|
If Cell.Value Like "*.*" Then Cells(x, 5) = Cells(x, 4)
Knowledge is power.
|
Bonjour,
Il faut écrire la boucle de recherche dans une fonction qui renvoie True si elle trouve les 2 mots ou False si elle ne trouve pas : Private Sub CommandButton1_Click()
Dim Cible As String
Cible1 = TextBox1.Text
Cible2 = TextBox2.Text
If SearchMot(Cible1, Cible2) = True Then
MsgBox "Oui"
Else
MsgBox "non"
End If
End Sub
Private Function SearchMot(ByVal c1 As String, ByVal c2 As String) As Boolean
Dim i As Long
For i = 1 To Rows.Count
If (InStr(Cible1, Cells(i, 1)) = 1) And (InStr(Cible2, Cells(i, 2)) = 1) Then
SearchMot = True
Exit Function
Else
SearchMot = False
End If
Next i
End Function
;o) Polux |
oups erreur de post ... :-s .. |