sub ou function non définie avec une boucle
Bonjour,
je souhaite modifier la couleur de 6 textbox (eva1à 6) pour l'impression mais je n'y arrive pas en faisant une boucle.
avec le code suivant ça marche
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Sub Imprimer2_Click()
eva1.BackColor = RGB(255, 255, 255)
eva2.BackColor = RGB(255, 255, 255)
eva3.BackColor = RGB(255, 255, 255)
eva4.BackColor = RGB(255, 255, 255)
eva5.BackColor = RGB(255, 255, 255)
eva6.BackColor = RGB(255, 255, 255)
ActiveWindow.SelectedSheets.PrintOut Copies:=1
eva1.BackColor = RGB(198, 235, 244)
eva2.BackColor = RGB(198, 235, 244)
eva3.BackColor = RGB(198, 235, 244)
eva4.BackColor = RGB(198, 235, 244)
eva5.BackColor = RGB(198, 235, 244)
eva6.BackColor = RGB(198, 235, 244)
End Sub |
Mais avec la boucle suivante j'ai le message "Erreur de compilation:Sub ou Function non définie"
Code:
1 2 3 4 5 6 7 8 9 10 11
| Sub Imprimer1_Click()
Dim i As Integer
For i = 1 To 6
eva(i).BackColor = RGB(255, 255, 255)
Next
ActiveWindow.SelectedSheets.PrintOut Copies:=1
For i = 1 To 6
eva(i).BackColor = RGB(198, 235, 244)
Next
End Sub |
Merci de votre aide :lol: