Bonjour à tous,
Me voici devant une question qui n'a rien à voir avec mes autres posts. J'ai beau trouver plein de semblants de réponses, aucun ne conviennent vraiment.
Voici mon problème. Je souhaite comparer ce qu'il y a dans une cellule (Cells(intLig, 22)) à une colonne entière, pour chercher si je trouve la même valeur Range("W2:W1010")
Petite difficulté, je ne peux pas comparer Cells et Range.
Voici le code en question, je vais souligner la partie me posant le problème (désolé d'avance si le code semble chaotique, je l'ai gratté rapidement en début d'après midi^^)
Sub PMID_PMRQ()
Dim intLig As Long
Dim intCol As Long
Dim derling As Long
intLig = 2
derlig = 1010
Do While intLig <> derlig
If Cells(intLig, 22) = "-" Then
Cells(intLig, 26) = "Conserver la ligne"
Else
If Cells(intLig, 22) = Range("W2:W1010") Then
If Cells(intLig, 21) = "CRED" Then
Cells(intLig, 26) = "Effacer ligne de PMRQ en relation"
Else
If Cells(intLig, 21) = "CRBY" Then
Cells(intLig, 26) = "Effacer cette ligne"
Else
Cells(intLig, 26) = "Conserver la ligne"
intLig = intLig + 1
End If
End If
End If
End If
Loop
End Sub
Merci d'avance de votre aide.
Kraenys
Me voici devant une question qui n'a rien à voir avec mes autres posts. J'ai beau trouver plein de semblants de réponses, aucun ne conviennent vraiment.
Voici mon problème. Je souhaite comparer ce qu'il y a dans une cellule (Cells(intLig, 22)) à une colonne entière, pour chercher si je trouve la même valeur Range("W2:W1010")
Petite difficulté, je ne peux pas comparer Cells et Range.
Voici le code en question, je vais souligner la partie me posant le problème (désolé d'avance si le code semble chaotique, je l'ai gratté rapidement en début d'après midi^^)
Sub PMID_PMRQ()
Dim intLig As Long
Dim intCol As Long
Dim derling As Long
intLig = 2
derlig = 1010
Do While intLig <> derlig
If Cells(intLig, 22) = "-" Then
Cells(intLig, 26) = "Conserver la ligne"
Else
If Cells(intLig, 22) = Range("W2:W1010") Then
If Cells(intLig, 21) = "CRED" Then
Cells(intLig, 26) = "Effacer ligne de PMRQ en relation"
Else
If Cells(intLig, 21) = "CRBY" Then
Cells(intLig, 26) = "Effacer cette ligne"
Else
Cells(intLig, 26) = "Conserver la ligne"
intLig = intLig + 1
End If
End If
End If
End If
Loop
End Sub
Merci d'avance de votre aide.
Kraenys