C
Chris
Guest
Bonjour le forum
Sur l'aplication en VBA, il reste un bug que je ne comprend pas lors de l'operation de copier / coller.
La commande activesheet.paste ne fonctionne pas.
Si qqun à une idée.
Sub tri_statistique()
'
Application.ScreenUpdating = False
madate = InputBox("Quel mois voullez vous traiter ?", "Création des statistiques", "mm/aaaa")
If madate = "" Then Exit Sub
If madate < 36526 Then
MsgBox "Date non valide", vbCritical: Exit Sub
End If
Lemois = Month(madate)
annee = Year(madate)
Sheets("Histogen").Activate
Range("a8").Activate
Selection.AutoFilter Field:=6, Criteria1:=Lemois
Selection.AutoFilter Field:=7, Criteria1:=annee
Range("A9").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.Columns("m:m")).Select
Selection.Copy
nomfeuille = "Stat " & Format(madate, "mmm") & " " & Format(madate, "yyyy")
For Each ws In Worksheets
If ws.Name = nomfeuille Then
MsgBox "Statistique existante ", vbExclamation: Exit Sub
End If
Next
Sheets("Histostatvierge").Copy after:=Worksheets(Worksheets.Count)
ActiveSheet.Name = nomfeuille
Range("A13").Select
ActiveSheet.Paste
Range("a8").Select
Sheets("Histogen").Select
Selection.AutoFilter
Range("a6").Select
Application.CutCopyMode = False
MsgBox "Une nouvelle feuille stat à été crée"
End Sub
Merci d'avance
Sur l'aplication en VBA, il reste un bug que je ne comprend pas lors de l'operation de copier / coller.
La commande activesheet.paste ne fonctionne pas.
Si qqun à une idée.
Sub tri_statistique()
'
Application.ScreenUpdating = False
madate = InputBox("Quel mois voullez vous traiter ?", "Création des statistiques", "mm/aaaa")
If madate = "" Then Exit Sub
If madate < 36526 Then
MsgBox "Date non valide", vbCritical: Exit Sub
End If
Lemois = Month(madate)
annee = Year(madate)
Sheets("Histogen").Activate
Range("a8").Activate
Selection.AutoFilter Field:=6, Criteria1:=Lemois
Selection.AutoFilter Field:=7, Criteria1:=annee
Range("A9").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.Columns("m:m")).Select
Selection.Copy
nomfeuille = "Stat " & Format(madate, "mmm") & " " & Format(madate, "yyyy")
For Each ws In Worksheets
If ws.Name = nomfeuille Then
MsgBox "Statistique existante ", vbExclamation: Exit Sub
End If
Next
Sheets("Histostatvierge").Copy after:=Worksheets(Worksheets.Count)
ActiveSheet.Name = nomfeuille
Range("A13").Select
ActiveSheet.Paste
Range("a8").Select
Sheets("Histogen").Select
Selection.AutoFilter
Range("a6").Select
Application.CutCopyMode = False
MsgBox "Une nouvelle feuille stat à été crée"
End Sub
Merci d'avance