Bonjour,
Voilà, je viens de réaliser mon premier code (Grace à l'aide de nombreux exemples du site). Cela dit je ne suis pas encore satisfaite du résultat.
Le code consiste à copier (Uniquement les valeurs et non les formules) une feuille nommée "Offre" d'un classeur nommé "Cotation", l'enregistrer sous un répertoire "Archives Cotations" sous un numéro dont le format est : Code Agence+Année+Mois+Numéro de cotation.
Y aurait un code copier-Mise en format plus court et qui rendrait pour le coup la macro + efficace ?
Ci après copie du code.
Merci de votre aide
Zouzou93
Sub Enregistre()
Application.StatusBar = "Veuillez Patienter SVP"
[G1].Value = [G1].Value + 1
Range("E1:G1").Select
Selection.Font.ColorIndex = 0
Cells.Select
Selection.Copy
Workbooks.Add
Cells.Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.787401575)
.RightMargin = Application.InchesToPoints(0.787401575)
.TopMargin = Application.InchesToPoints(0.984251969)
.BottomMargin = Application.InchesToPoints(0.984251969)
.HeaderMargin = Application.InchesToPoints(0.4921259845)
.FooterMargin = Application.InchesToPoints(0.4921259845)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDisplayed
End With
Range("D3").Select
Application.StatusBar = False
ThisWorkbook.Save
ChDir "Z:\documents\Outils\ARCHIVES COTATIONS\"
ActiveWorkbook.SaveAs Filename:="Z:\documents\Outils\ARCHIVES COTATIONS\" & [E1].Value & " " & Format([F1].Value, "yyyymm") & " " & [G1] & ".xls", FileFormat:=xlNormal
ActiveWorkbook.Close (False)
msg = "Votre Cotation a été sauvegardée"
Title = "Sauvegarde de la cotation actuelle"
Style = vbOKOnly + vbInformation
Reponse = MsgBox(msg, Style, Title)
End Sub
Voilà, je viens de réaliser mon premier code (Grace à l'aide de nombreux exemples du site). Cela dit je ne suis pas encore satisfaite du résultat.
Le code consiste à copier (Uniquement les valeurs et non les formules) une feuille nommée "Offre" d'un classeur nommé "Cotation", l'enregistrer sous un répertoire "Archives Cotations" sous un numéro dont le format est : Code Agence+Année+Mois+Numéro de cotation.
Y aurait un code copier-Mise en format plus court et qui rendrait pour le coup la macro + efficace ?
Ci après copie du code.
Merci de votre aide
Zouzou93
Sub Enregistre()
Application.StatusBar = "Veuillez Patienter SVP"
[G1].Value = [G1].Value + 1
Range("E1:G1").Select
Selection.Font.ColorIndex = 0
Cells.Select
Selection.Copy
Workbooks.Add
Cells.Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.787401575)
.RightMargin = Application.InchesToPoints(0.787401575)
.TopMargin = Application.InchesToPoints(0.984251969)
.BottomMargin = Application.InchesToPoints(0.984251969)
.HeaderMargin = Application.InchesToPoints(0.4921259845)
.FooterMargin = Application.InchesToPoints(0.4921259845)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDisplayed
End With
Range("D3").Select
Application.StatusBar = False
ThisWorkbook.Save
ChDir "Z:\documents\Outils\ARCHIVES COTATIONS\"
ActiveWorkbook.SaveAs Filename:="Z:\documents\Outils\ARCHIVES COTATIONS\" & [E1].Value & " " & Format([F1].Value, "yyyymm") & " " & [G1] & ".xls", FileFormat:=xlNormal
ActiveWorkbook.Close (False)
msg = "Votre Cotation a été sauvegardée"
Title = "Sauvegarde de la cotation actuelle"
Style = vbOKOnly + vbInformation
Reponse = MsgBox(msg, Style, Title)
End Sub