Erreur d'exécution '13': Incompatibilité de type

Bennn

XLDnaute Nouveau
Bonjour le forum,
Je souhaiterais profiter de vos lumières pour un souci dans une macro. Je veux identifier les doublons dans une colonne et en écrivant le code ci-après (grâce à la capitalisation d'info sur le forum), il y a un message d'erreur cité en sujet.
Pourriez vous me dire ce qui ne va pas dans ma synraxe.
Merci de vos réponses

Private Sub ComboBox1_Change()

Dim Plage As Range, Cell As Range
Dim Msg As String
'Dim i As Integer
Dim i As Variant

With Worksheets('tableau')
derlign1 = .Range('A65536').End(xlUp).Row
For Each codelign1 In Worksheets('tableau').Range('A2:A' & derlign1)
If codelign1 = ComboBox1 Then
ComboBox2 = .Range(Cells(codelign1.Row, 2).Address).Value
ComboBox3 = .Range(Cells(codelign1.Row, 3).Address).Value
ComboBox4 = .Range(Cells(codelign1.Row, 4).Address).Value
ComboBox5 = .Range(Cells(codelign1.Row, 5).Address).Value
ComboBox6 = .Range(Cells(codelign1.Row, 6).Address).Value
TextBox1 = .Range(Cells(codelign1.Row, 8).Address).Value
TextBox2 = .Range(Cells(codelign1.Row, 9).Address).Value
TextBox3 = .Range(Cells(codelign1.Row, 10).Address).Value
TextBox4 = .Range(Cells(codelign1.Row, 11).Address).Value
TextBox5 = .Range(Cells(codelign1.Row, 12).Address).Value
TextBox6 = .Range(Cells(codelign1.Row, 13).Address).Value
TextBox7 = .Range(Cells(codelign1.Row, 14).Address).Value
TextBox8 = .Range(Cells(codelign1.Row, 15).Address).Value

lign1 = codelign1.Row
End If
Next codelign1
End With
Worksheets('tableau').Activate


Set Plage = Range('a2:a' & derlign1)

MsgBox 'Il y a ' & Plage.Count & ' cellules, nous allons les scanner et les colorier'
i = 0
For Each codelign1 In Plage
'For Each Cell In Worksheets('tableau').Range('A2:A' & derlign1)
If codelign1 = ComboBox1 Then
i = i + 1
'Msg = Msg & 'Cellule ' & i & ' : ' & Cell.Address(0, 0) & vbCrLf
'Cell.Interior.ColorIndex = 3
End If
Next

MsgBox 'Voici la Liste des ' & Plage.Count & ' cellules :' & vbCrLf & Msg



End Sub
 

Discussions similaires

Réponses
6
Affichages
202

Statistiques des forums

Discussions
311 711
Messages
2 081 794
Membres
101 817
dernier inscrit
carvajal