Sheets("Feuil1").Activate
For counter = 1 To 1500
[COLOR="Red"] If Cells(counter, 9).Value <> Cells(counter, 5).Value Then[/COLOR]
Cells(counter, 9).Copy
Cells(counter, 5).Select
Selection.PasteSpecial Paste:=xlPasteValues
End If
Next counter
Le message incompatibilité de type apparait.
Je vous joindrait bien le fichier mais il est vraiment tros gros.
Dim counter As Integer
Sheets("Feuil1").Activate
For counter = 1 To 1500
If Cells(counter, 9).Value <> Cells(counter, 5).Value Then
Cells(counter, 9).Copy
Cells(counter, 5).PasteSpecial Paste:=xlPasteValues
End If
Next counter
enfin, chez moi cela fonctionne aussi bien avec nombre que texte dans cellulule.. Si tu n'as plus de problème, c'est le principale
Edition : on pouvait faire un peu plus court...
Code:
Dim counter As Integer
Sheets("Feuil1").Activate
For counter = 1 To 1500
If Cells(counter, 9).Value <> Cells(counter, 5).Value Then
Cells(counter, 5).Value = Cells(counter, 9).Value
End If
Next counter
pas de problème chez moi, mais faudrait voir le contenu de tes cellules, par contre si tu supprimes des lignes il est préférable de commencer par la fin, car si le test s'avère exacte sur 2 lignes consécutives seule la première serait supprimée...
Code:
Sub test()
Dim countera As Integer
For countera = 1500 To 1 Step -1
If Cells(countera, 9).Value = 0 Or Cells(countera, 13).Value <> "" Then
Rows(countera).Delete
End If
Next countera
End Sub