Bonjour Nad, forum,
Je partais dans une autre direction mais ta solution est + simple,
--- petites remarques sur ton code (constructives) ---
1) le Step -1 t'oblige à gérer l'erreur de ligne zéro
2) c = c.Value => évite de trainer les formules
Application.ScreenUpdating = True n'est pas obligatoire en fin de macro
évite les .Select
Ce qui donne:
Sub Numéros()
Dim i As Integer, j As Integer
Dim c As Range
Range("A2:N10000").ClearContents
Application.ScreenUpdating = False
Range("Numeros").Copy Sheets("Feuil2").Range("A2")
j = Range("A65536").End(xlUp).Row
For i = 1 To j
If Cells(i + 1, 1) = Cells(i, 1) Then Cells(i + 1, 1).ClearContents
Next i
For Each c In Range("B2:N" & j)
c.FormulaR1C1 = "=IF(ISNUMBER(MATCH(R1C,Feuil1!RC6:RC11,0)),""X"","""")"
c = c.Value
Next c
Range("A1").Activate
End Sub
Bonne journée
Claude
Edit de Nad : merci Claude - J'ai bien compris la correction
-- Mer Juin 23, 2010 11:47 am --
re,
Autre version, je la met quand même
Sub Tableau2()
'Macro par Claude Dubois pour "maguetlolo" Excel-Pratique le 23/06/10
Dim Lg&, i%, J As Byte, Cl As Byte
Application.ScreenUpdating = False
Lg = Range("b65536").End(xlUp).Row
For i = 2 To Lg
For J = 6 To 11 'colonnes
Select Case Cells(i, J)
Case Is = "rond": Cl = 3 'Cl = colonne
Case Is = "carré": Cl = 4
Case Is = "triangle": Cl = 5
Case Is = "rectangle": Cl = 6
Case Is = "lourd": Cl = 7
Case Is = "leger": Cl = 8
Case Is = "moyen": Cl = 9
Case Is = "moche": Cl = 10
Case Is = "beau": Cl = 11
Case Is = "bleu": Cl = 12
Case Is = "rouge": Cl = 13
Case Is = "court": Cl = 14
Case Is = "long": Cl = 15
Case Else: Exit For
End Select
With Sheets("Feuil2")
If Cells(i, 2) <> Cells(i - 1, 2) Then
.Cells(i, 2) = Cells(i, 2)
End If
.Cells(i, 1) = Cells(i, 1) 'si besoin colonne A
.Cells(i, Cl) = "X"
End With
Next J
Next i
Sheets("Feuil2").Activate
End Sub
Faudrait comparer les 2 solutions avec les 8000 lignes
Amicalement
Claude