Remplacer Sheets().select par with Sheets()
Bonjour à tous,
J'ai un code qui marche avec Sheets().select , mais j'aimerai éviter le .select car cela me ramène sur la feuille selectionnée. J'ai essayé avec with mas ça ne marche pas. Voici le code avec select :
Code:
1 2 3 4 5 6 7 8
|
Sheets("Consommation").Select
LigneA = Range("A" & Rows.Count).End(xlUp).Row
LigneB = Range("B" & Rows.Count).End(xlUp).Row
ComboBox1.RowSource = "A5:A" & LigneA - 2
ComboBox2.RowSource = "B5:B" & LigneB - 2 |
Et voici ce que j'ai essayé avec with :
Citation:
With Sheets("Consommation")
LigneA = .Range("A" & .Rows.Count).End(xlUp).Row
LigneB = .Range("B" & .Rows.Count).End(xlUp).Row
ComboBox1.RowSource = "A5:A" & LigneA - 2
ComboBox2.RowSource = "B5:B" & LigneB - 2
End With
Est ce que quelqu'un pourrait m'aider? Merci