Bonjour,
merci pour votre retour si rapide ;-)
J'avoue ne pas avoir tout compris, et en modifiant ma macro comme indiqué par Robert, ça plante ... je pense qurtout que je en vous ai pas donné toutes les infos ...
Voici la macro en totalité ... c'est une macro enregistrée automatiquement et retravaillée ensuite.
Pas d'inquiétude, je n'ai rien touché sur la fin (au niveau de la mise en page) pour le moment ...
Concrètement que compile les infos d'un fichier de base (export CDD) dans un autre fichier pour faire un suivi (suivi CDD)
Merci pour aide.
Delphine
Sub IMPORT()
'
' IMPORT Macro
'
Sheets("feuil1").Select
Range("A4:i4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Windows("ExportFINCDD.xls").Activate
Range("a1").Select
Selection.AutoFilter
ActiveSheet.Range("$a$1:$BG$22").AutoFilter Field:=29, Criteria1:="="
Columns("D
").Select
Application.CutCopyMode = False
Selection.Copy
Windows("suivi CDD.xlsm").Activate
Range("A3").Select
ActiveSheet.Paste
Windows("ExportFINCDD.xls").Activate
Columns("F:g").Select
Application.CutCopyMode = False
Selection.Copy
Windows("suivi CDD.xlsm").Activate
Range("B3").Select
ActiveSheet.Paste
Windows("ExportFINCDD.xls").Activate
Columns("R:R").Select
Application.CutCopyMode = False
Selection.Copy
Windows("suivi CDD.xlsm").Activate
Range("D3").Select
ActiveSheet.Paste
Windows("ExportFINCDD.xls").Activate
Columns("T:T").Select
Application.CutCopyMode = False
Selection.Copy
Windows("suivi CDD.xlsm").Activate
Range("E3").Select
ActiveSheet.Paste
Windows("ExportFINCDD.xls").Activate
Columns("V:V").Select
Application.CutCopyMode = False
Selection.Copy
Windows("suivi CDD.xlsm").Activate
Range("F3").Select
ActiveSheet.Paste
Windows("ExportFINCDD.xls").Activate
Columns("AA:AA").Select
Application.CutCopyMode = False
Selection.Copy
Windows("suivi CDD.xlsm").Activate
Range("G3").Select
ActiveSheet.Paste
Windows("ExportFINCDD.xls").Activate
Columns("AC:AC").Select
Application.CutCopyMode = False
Selection.Copy
Windows("suivi CDD.xlsm").Activate
Range("H3").Select
ActiveSheet.Paste
Range("I3").Select
Selection.Style = "RowLevel_4"
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
ActiveCell.FormulaR1C1 = "SUITE A DONNER"
Rows("3:3").Select
Selection.Font.Bold = True
Selection.Font.Size = 12
Selection.Font.Size = 14
Selection.Font.Size = 12
Selection.Copy
Application.CutCopyMode = False
Range("I3").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -4.99893185216834E-02
.PatternTintAndShade = 0
End With
Range("A3").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Cells.Select
Cells.EntireColumn.AutoFit
Range("H3:I3").Select
Range(Selection, Selection.End(xlDown)).Select
With Selection
.HorizontalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("G:G").ColumnWidth = 12.71
Columns("G:H").Select
Selection.ColumnWidth = 15.14
Range("I1").Select
Columns("I:I").ColumnWidth = 43
Cells.Select
Selection.ColumnWidth = 13.71
Cells.EntireRow.AutoFit
Range("C14").Select
Columns("C:C").ColumnWidth = 19.29
Rows("14:14").EntireRow.AutoFit
Range("G13").Select
'TRI'
Range("H8").Select
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range("H8"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Feuil1").Sort
.SetRange Range("A3:I37")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub