For Each c In .Range("F3", .Cells(.Rows.Count, 6).Cells.End(xlUp)) ?

re4

XLDnaute Occasionnel
Bonjour,
Ma connaissance est limité... ,-)
Le code ci-dessous fonctionne bien et j’obtiens en colonne G la syntaxe suivant pour exemple : 20_nom si le 20 est en cellule C3 et si le nom est en cellule F3
Ca se complique si je veux le nom en cellule E3, (je remplace le F3 par E3), ça ne marche pas, je suppose qu'il y a autre chose à modifier.
Merci pour votre aide

VB:
With Sheets("Choix")
          
             Set Plage = .Range("C3", .Cells(.Rows.Count, 3).End(xlUp)) ' notes

                   For Each c In .Range("F3", .Cells(.Rows.Count, 6).Cells.End(xlUp)) '

                       If c.Offset(, -5) = "" Then Exit For
                    
             c.Offset(, 1) = Format(Application.Rank(c.Offset(, -3), Plage), "000") & "_" & _
                 c.Value                           

             [Choix!F1] = [Choix_Expos!F1] + 1 m

            [Choix!G1] = c.Offset(, 1).Value
            
         Next c
 

frangy

XLDnaute Occasionnel
Bonjour,

Essaie comme cela ...
VB:
    With Sheets("Choix")
        Set Plage = .Range("C3", .Cells(.Rows.Count, 3).End(xlUp)) ' notes
        For Each c In .Range("E3", .Cells(.Rows.Count, 5).Cells.End(xlUp)) '
            If c.Offset(, -4) = "" Then Exit For
            c.Offset(, 2) = Format(Application.Rank(c.Offset(, -2), Plage), "000") & "_" & c.Value
            [Choix!F1] = [Choix_Expos!F1] + 1
            [Choix!G1] = c.Offset(, 2).Value
        Next c
    End With
Cordialement.
 

Discussions similaires

Statistiques des forums

Discussions
312 211
Messages
2 086 293
Membres
103 171
dernier inscrit
clemm