Macro avec "range" qui n'oppère pas bien...

Rick@

XLDnaute Occasionnel
Bonjour,

J'ai ajouté à ma macro (qui fonctionnait très bien) un deuxième choix de combo (3) et j'ai demandé un autre "range" (A88) mais voilà ce dernier domine sur le premier. Comment arriver à obtenir des "ranges" séparés selon le combo qui est activé?

Sub Copie()
If Feuil3.ComboBox2 = "Commercial" Then
Rows("120:124").Copy Rows("101:101")
Feuil3.Range("A1").Select
End If
If Feuil3.ComboBox2 = "Résidentiel" Then
Rows("126:130").Copy Rows("101:101")
Feuil3.Range("A1").Select
End If
If Feuil3.ComboBox2 = "Recouvrement" Then
Rows("132:136").Copy Rows("101:101")
Feuil3.Range("A1").Select
End If
If Feuil3.ComboBox3 = "COMM" Then
Rows("151:155").Copy Rows("143:143")
Feuil3.Range("A88").Select
End If
If Feuil3.ComboBox3 = "RÉS" Then
Rows("158:162").Copy Rows("143:143")
Feuil3.Range("A88").Select
End If
If Feuil3.ComboBox3 = "REC" Then
Rows("165:169").Copy Rows("143:143")
Feuil3.Range("A88").Select
End If
End Sub


Merci à l'avance!!!:)
 

JNP

XLDnaute Barbatruc
Re : Macro avec "range" qui n'oppère pas bien...

Bonjour le fil :),
Si j'ai bien compris, par négation
Code:
Sub Copie()
If Feuil3.ComboBox2 = "Commercial" Then
Rows("120:124").Copy Rows("101:101")
ElseIf Feuil3.ComboBox2 = "Résidentiel" Then
Rows("126:130").Copy Rows("101:101")
ElseIf Feuil3.ComboBox2 = "Recouvrement" Then
Rows("132:136").Copy Rows("101:101")
Else
Feuil3.Range("A88").Select
End If
If Feuil3.ComboBox3 = "COMM" Then
Rows("151:155").Copy Rows("143:143")
ElseIf Feuil3.ComboBox3 = "RÉS" Then
Rows("158:162").Copy Rows("143:143")
ElseIf Feuil3.ComboBox3 = "REC" Then
Rows("165:169").Copy Rows("143:143")
Else
Feuil3.Range("A1").Select
End If
End Sub
Non testé, évidemment, sans fichier fourni :(...
Bonne journée :cool:
 

Discussions similaires

Réponses
3
Affichages
591

Statistiques des forums

Discussions
312 305
Messages
2 087 093
Membres
103 467
dernier inscrit
Pandiska