modification programme

JUDOKA

XLDnaute Nouveau
Bonjour,

Je voudrais dans cette macro ajouté une poule de 3 comment faire
merci




Sub Macro4()
'
' Macro4 Macro
'

If I >= J Then

' Traitement poule de 4
'-----------------------
IndiceDeb = 0
IndiceFin = 0

For K = 1 To I
IndiceDeb = IndiceFin + 1
IndiceFin = IndiceDeb + 3

Sheets("Poule4").Copy Before:=Sheets(1)
Sheets("Poule4 (2)").Select
Sheets("Poule4 (2)").Name = "Poule4 " + nom + Str(K)
Sheets(nom).Select
Range("A" + CStr(IndiceDeb) + ":D" + CStr(IndiceFin)).Select
Selection.Copy
Sheets("Poule4 " + nom + Str(K)).Select
Range("A14").Select
ActiveSheet.Paste

Next K

' Traitement poule de 5
'-----------------------

For F = 1 To J

IndiceDeb = IndiceFin + 1
IndiceFin = IndiceDeb + 4

Sheets("Poule5").Copy Before:=Sheets(1)
Sheets("Poule5 (2)").Select
Sheets("Poule5 (2)").Name = "Poule5 " + nom + Str(F)
Sheets(nom).Select
Range("A" + CStr(IndiceDeb) + ":D" + CStr(IndiceFin)).Select
Selection.Copy
Sheets("Poule5 " + nom + Str(F)).Select
Range("A14").Select
ActiveSheet.Paste
Next F
End If

If I < J Then


IndiceDeb = 0
IndiceFin = 0

' Traitement poule de 5
'-----------------------

For F = 1 To J

IndiceDeb = IndiceFin + 1
IndiceFin = IndiceDeb + 4

Sheets("Poule5").Copy Before:=Sheets(1)
Sheets("Poule5 (2)").Select
Sheets("Poule5 (2)").Name = "Poule5 " + nom + Str(F)
Sheets(nom).Select
Range("A" + CStr(IndiceDeb) + ":D" + CStr(IndiceFin)).Select
Selection.Copy
Sheets("Poule5 " + nom + Str(F)).Select
Range("A14").Select
ActiveSheet.Paste
Next F

' Traitement poule de 4
'-----------------------
For K = 1 To I

IndiceDeb = IndiceFin + 1
IndiceFin = IndiceDeb + 3







Sheets("Poule4").Copy Before:=Sheets(1)
Sheets("Poule4 (2)").Select
Sheets("Poule4 (2)").Name = "Poule4 " + nom + Str(K)
Sheets(nom).Select
Range("A" + CStr(IndiceDeb) + ":D" + CStr(IndiceFin)).Select
Selection.Copy
Sheets("Poule4 " + nom + Str(K)).Select
Range("A14").Select
ActiveSheet.Paste
Next K


End If

End Sub
 

Fred0o

XLDnaute Barbatruc
Re : modification programme

Bonjour judoka,

J'ai pourtant essayé mais sans succès.

Ta demande est incompréhensible, même après lecture de ton code qui copie des feuilles nommées "Poule4 (ou 5)" + quelquechose, en fonction de variables I, J, K et F.

Si tu ne nous situe pas le contexte, ni ce que tu veux faire exactement, ça va être compliqué. Le mieux est un fichier exemple avec des explications.

A bientôt
 

Discussions similaires

Réponses
2
Affichages
966

Statistiques des forums

Discussions
312 786
Messages
2 092 101
Membres
105 203
dernier inscrit
Apollo97