XL 2016 vba

Guismo33

XLDnaute Occasionnel
Bonjour a tous, et bonne année,

j'ai créer un tableau, dans se tableau un résultat (123 ou 1234) et je voudrais dans un autre tableau
qu'il met que des 1 dans la même position que le premier tableau.
Exemple :
en G4= To donc en B4=1 , C4=2, D4=3
et là sure le 2° tableau on retrouve
en B35=1 , C35=1, D35=1
Joint fichier

merci a tous

Bien à vous
 

Pièces jointes

  • exemple.xlsm
    28.7 KB · Affichages: 43

Lone-wolf

XLDnaute Barbatruc
Bonjour Guimo et bonne année.

Pas sûr d'avoir compris. Un essai. En H2-K2 tu inscrit 1-1-2-3 et tu met le Font en blanc.

VB:
Public lig As Long, col As Long, c As Range, cel As Range

Sub Distribue()
With Feuil1
    lig = .Cells(Rows.Count, "B").End(xlUp).Row + 1

    For Each c In .Range("g4:g31")
        Set cel = .Range("h3:i3").Find(c, , , , xlByColumns, xlPrevious)
        If Not cel Is Nothing Then
        .Cells(lig, cel.Offset(0, -6).Column) = cel.Offset(-1, 0)
        End If
    Next c
    lig = .Cells(Rows.Count, "H").End(xlUp).Row + 1

    For Each c In .Range("g4:g31")
        Set cel = .Range("j3:k3").Find(c, , , , xlByColumns, xlPrevious)
        If Not cel Is Nothing Then
        .Cells(lig, cel.Column) = cel.Offset(-1, 0)
        End If
    Next c
End With
End Sub
 

Discussions similaires

Membres actuellement en ligne

Statistiques des forums

Discussions
312 105
Messages
2 085 350
Membres
102 870
dernier inscrit
Armisa