Boucle labels de meme ligne Sur Plusieurs Colonnes

salhi_haithem

XLDnaute Junior
Bonjour tout le monde,

J'ai plusieurs cellule sur une même ligne d'une feuille excel et je souhaite les transférer dans Mes labels de mon userfom;

ce que j'ai :

Code:
Me.Label91.Caption = Cells(5, 2) 'N°
Me.Label92.Caption = Cells(5, 3) 'Etat
Me.Label93.Caption = Cells(5, 4) 'Equipement
Me.Label94.Caption = Cells(5, 5) 'Service

Me.Label95.Caption = Cells(5, 7) 'Debut

Me.Label96.Caption = Cells(5, 10)
Me.Label97.Caption = Cells(5, 11)
Me.Label98.Caption = Cells(5, 12)
Me.Label99.Caption = Cells(5, 13)
Me.Label100.Caption = Cells(5, 14)
Me.Label101.Caption = Cells(5, 15)
Me.Label102.Caption = Cells(5, 16)
Me.Label103.Caption = Cells(5, 17)
Me.Label104.Caption = Cells(5, 18)
Me.Label105.Caption = Cells(5, 19)
Me.Label106.Caption = Cells(5, 20)
Me.Label107.Caption = Cells(5, 21)
Me.Label108.Caption = Cells(5, 22)
Me.Label109.Caption = Cells(5, 23)
Me.Label110.Caption = Cells(5, 24)
Me.Label111.Caption = Cells(5, 25)
Me.Label112.Caption = Cells(5, 26)
Me.Label111.Caption = Cells(5, 25)
Me.Label112.Caption = Cells(5, 26)
Me.Label113.Caption = Cells(5, 27)
Me.Label114.Caption = Cells(5, 28)
Me.Label115.Caption = Cells(5, 29)
Me.Label116.Caption = Cells(5, 30)
Me.Label117.Caption = Cells(5, 31)
Me.Label118.Caption = Cells(5, 32)
Me.Label119.Caption = Cells(5, 33)
Me.Label120.Caption = Cells(5, 34)
Me.Label121.Caption = Cells(5, 35)
Me.Label122.Caption = Cells(5, 36)
Me.Label123.Caption = Cells(5, 37)
Me.Label124.Caption = Cells(5, 38)
Me.Label125.Caption = Cells(5, 39)

Me.Label126.Caption = Cells(6, 2) 'N°
Me.Label127.Caption = Cells(6, 3) 'Etat
Me.Label128.Caption = Cells(6, 4) 'Equipement
Me.Label129.Caption = Cells(6, 5) 'Service

Me.Label130.Caption = Cells(6, 7) 'Debut

Me.Label131.Caption = Cells(6, 10)
Me.Label132.Caption = Cells(6, 11)
Me.Label133.Caption = Cells(6, 12)
Me.Label134.Caption = Cells(6, 13)
Me.Label135.Caption = Cells(6, 14)
Me.Label136.Caption = Cells(6, 15)
Me.Label137.Caption = Cells(6, 16)
Me.Label138.Caption = Cells(6, 17)
Me.Label139.Caption = Cells(6, 18)
Me.Label140.Caption = Cells(6, 19)
Me.Label141.Caption = Cells(6, 20)
Me.Label142.Caption = Cells(6, 21)
Me.Label143.Caption = Cells(6, 22)
Me.Label144.Caption = Cells(6, 23)
Me.Label145.Caption = Cells(6, 24)
Me.Label146.Caption = Cells(6, 25)
Me.Label147.Caption = Cells(6, 26)
Me.Label148.Caption = Cells(6, 27)
Me.Label149.Caption = Cells(6, 28)
Me.Label150.Caption = Cells(6, 29)
Me.Label151.Caption = Cells(6, 30)
Me.Label152.Caption = Cells(6, 31)
Me.Label153.Caption = Cells(6, 32)
Me.Label154.Caption = Cells(6, 33)
Me.Label155.Caption = Cells(6, 34)
Me.Label156.Caption = Cells(6, 35)
Me.Label157.Caption = Cells(6, 36)
Me.Label158.Caption = Cells(6, 37)
Me.Label159.Caption = Cells(6, 38)
Me.Label160.Caption = Cells(6, 39)


Me.Label161.Caption = Cells(7, 2) 'N°
Me.Label162.Caption = Cells(7, 3) 'Etat
Me.Label163.Caption = Cells(7, 4) 'Equipement
Me.Label164.Caption = Cells(7, 5) 'Service

Me.Label165.Caption = Cells(7, 7) 'Debut

Me.Label166.Caption = Cells(7, 10)
Me.Label167.Caption = Cells(7, 11)
Me.Label168.Caption = Cells(7, 12)
Me.Label169.Caption = Cells(7, 13)
Me.Label170.Caption = Cells(7, 14)
Me.Label171.Caption = Cells(7, 15)
Me.Label172.Caption = Cells(7, 16)
Me.Label173.Caption = Cells(7, 17)
Me.Label174.Caption = Cells(7, 18)
Me.Label175.Caption = Cells(7, 19)
Me.Label176.Caption = Cells(7, 20)
Me.Label177.Caption = Cells(7, 21)
Me.Label178.Caption = Cells(7, 22)
Me.Label179.Caption = Cells(7, 23)
Me.Label180.Caption = Cells(7, 24)
Me.Label181.Caption = Cells(7, 25)
Me.Label182.Caption = Cells(7, 26)
Me.Label183.Caption = Cells(7, 27)
Me.Label184.Caption = Cells(7, 28)
Me.Label185.Caption = Cells(7, 29)
Me.Label186.Caption = Cells(7, 30)
Me.Label187.Caption = Cells(7, 31)
Me.Label188.Caption = Cells(7, 32)
Me.Label189.Caption = Cells(7, 33)
Me.Label190.Caption = Cells(7, 34)
Me.Label191.Caption = Cells(7, 35)
Me.Label192.Caption = Cells(7, 36)
Me.Label193.Caption = Cells(7, 37)
Me.Label194.Caption = Cells(7, 38)
Me.Label195.Caption = Cells(7, 39)

Me.Label196.Caption = Cells(8, 2) 'N°
Me.Label197.Caption = Cells(8, 3) 'Etat
Me.Label198.Caption = Cells(8, 4) 'Equipement
Me.Label199.Caption = Cells(8, 5) 'Service

Me.Label200.Caption = Cells(8, 7) 'Debut

Me.Label201.Caption = Cells(8, 10)
Me.Label202.Caption = Cells(8, 11)
Me.Label203.Caption = Cells(8, 12)
Me.Label204.Caption = Cells(8, 13)
Me.Label205.Caption = Cells(8, 14)
Me.Label206.Caption = Cells(8, 15)
Me.Label207.Caption = Cells(8, 16)
Me.Label208.Caption = Cells(8, 17)
Me.Label209.Caption = Cells(8, 18)
Me.Label210.Caption = Cells(8, 19)
Me.Label211.Caption = Cells(8, 20)
Me.Label212.Caption = Cells(8, 21)
Me.Label213.Caption = Cells(8, 22)
Me.Label214.Caption = Cells(8, 23)
Me.Label215.Caption = Cells(8, 24)
Me.Label216.Caption = Cells(8, 25)
Me.Label217.Caption = Cells(8, 26)
Me.Label218.Caption = Cells(8, 27)
Me.Label219.Caption = Cells(8, 28)
Me.Label220.Caption = Cells(8, 29)
Me.Label221.Caption = Cells(8, 30)
Me.Label222.Caption = Cells(8, 31)
Me.Label223.Caption = Cells(8, 32)
Me.Label224.Caption = Cells(8, 33)
Me.Label225.Caption = Cells(8, 34)
Me.Label226.Caption = Cells(8, 35)
Me.Label227.Caption = Cells(8, 36)
Me.Label228.Caption = Cells(8, 37)
Me.Label229.Caption = Cells(8, 38)
Me.Label230.Caption = Cells(8, 39)


Me.Label231.Caption = Cells(9, 2) 'N°
Me.Label232.Caption = Cells(9, 3) 'Etat
Me.Label233.Caption = Cells(9, 4) 'Equipement
Me.Label234.Caption = Cells(9, 5) 'Service

Me.Label235.Caption = Cells(9, 7) 'Debut

Me.Label236.Caption = Cells(9, 10)
Me.Label237.Caption = Cells(9, 11)
Me.Label238.Caption = Cells(9, 12)
Me.Label239.Caption = Cells(9, 13)
Me.Label240.Caption = Cells(9, 14)
Me.Label241.Caption = Cells(9, 15)
Me.Label242.Caption = Cells(9, 16)
Me.Label243.Caption = Cells(9, 17)
Me.Label244.Caption = Cells(9, 18)
Me.Label245.Caption = Cells(9, 19)
Me.Label246.Caption = Cells(9, 20)
Me.Label247.Caption = Cells(9, 21)
Me.Label248.Caption = Cells(9, 22)
Me.Label249.Caption = Cells(9, 23)
Me.Label250.Caption = Cells(9, 24)
Me.Label251.Caption = Cells(9, 25)
Me.Label252.Caption = Cells(9, 26)
Me.Label253.Caption = Cells(9, 27)
Me.Label254.Caption = Cells(9, 28)
Me.Label255.Caption = Cells(9, 29)
Me.Label256.Caption = Cells(9, 30)
Me.Label257.Caption = Cells(9, 31)
Me.Label258.Caption = Cells(9, 32)
Me.Label259.Caption = Cells(9, 33)
Me.Label260.Caption = Cells(9, 34)
Me.Label261.Caption = Cells(9, 35)
Me.Label262.Caption = Cells(9, 36)
Me.Label263.Caption = Cells(9, 37)
Me.Label264.Caption = Cells(9, 38)
Me.Label265.Caption = Cells(9, 39)


et ainsi de suite pour le reste.... :oops:

Quelqu'un peut m'aider S'il vous plait que je puisse trouver une macro en boucle pour cette proposition.

J'ai trouvé plusieurs tuto concernant seulement 1 colonne et plusieurs lignes mais pas dans mon cas. :roll:

Merci d'avance
 
Dernière édition:

Modeste geedee

XLDnaute Barbatruc
Re : Boucle labels de meme ligne Sur Plusieurs Colonnes

Bonjour tout le monde,

J'ai plusieurs cellule sur une même ligne d'une feuille excel et je souhaite les transférer dans Mes labels de mon userfom;
Code:
For ligne =0 to XXX ' nbr de lignes
    Me.Controls("Label" & 91+(35*ligne)).caption= Cells(Ligne+5, 2) 'N°
    Me.Controls("Label" & 92+(35*ligne)).caption= Cells(Ligne+5, 3) 'Etat
    Me.Controls("Label" & 93+(35*ligne)).caption= Cells(Ligne+5, 4) 'Equipement
    Me.Controls("Label" & 94+(35*ligne)).caption= Cells(Ligne+5, 5) 'Service

    Me.Controls("Label" & 96+(35*ligne)).caption= Cells(Ligne+5, 7) 'Debut

    For colonne= 0 to 29
          Me.Controls("Label" & 97+colonne+(35*ligne)).caption= Cells(Ligne+5, colonne+10)
    Next 
Next

il aurait toutefois été préférable de renommer les labels relativement à leur position dans la matrice d'affichage

ex : Label_1_5 ( rangée 1 position 5)
Label_5_22 (rangée 5 position 22)
 
Dernière édition:

Discussions similaires

Réponses
12
Affichages
694

Statistiques des forums

Discussions
312 321
Messages
2 087 266
Membres
103 502
dernier inscrit
talebafia