macro assez lourde, peut on l'alleger ??
au final voilà comment se présente ma macro. elle fonctionne.
mais je la trouve redondante ou lourde.
un avis ??
Dim info As String
Dim y As Long
Dim z As String
Dim reponse
y = 0
z = Sheets("calcul loyer").Range("m1").Value
info = InputBox(Prompt:= _
"Si vous Souhaitez lancer la création de factures par région, indiquer la région voulue. En laissant vide, toutes les régions seront générées.", _
Title:="Génération des factures par région")
If info = "" Then GoTo totale
Sheets("agences").Select
Range("a3").Select
For Each c In Range("a3:a" & Range("A65536").End(xlUp).Row)
If c.Offset(0, 1) <> info Then GoTo suivant
If c.Offset(0, 10) = "" Then GoTo suivant
If c.Offset(0, 9) = "SCI" Then GoTo suivant
If c.Offset(0, 9) = "fermée" Then GoTo suivant
Application.Run "new_facture"
Range("b4") = c.Value
Application.Run "complement"
Application.Run "enregistrer_effacer"
y = y + 1
suivant:
Next
MsgBox "Le traitement est fini." & y & " factures ont été enregistrées pour un montant total de " & z & " €"
End
totale:
reponse = MsgBox("Lancer la génération facture pour tous les CIA", vbYesNo, "Question")
If reponse = vbNo Then End
Sheets("agences").Select
Range("a3").Select
For Each c In Range("a3:a" & Range("A65536").End(xlUp).Row)
If c.Offset(0, 10) = "" Then GoTo suivant1
If c.Offset(0, 9) = "SCI" Then GoTo suivant1
If c.Offset(0, 9) = "fermée" Then GoTo suivant1
Application.Run "new_facture"
Range("b4") = c.Value
Application.Run "complement"
Application.Run "enregistrer_effacer"
y = y + 1
suivant1:
Next
MsgBox "Le traitement est fini." & y & " factures ont été enregistrées pour un montant total de " & z & " €"