1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
| Sub Macro1()
'
' Macro1 Macro
'
Workbooks.Open Filename:="O:\gti\production1.xls"
Columns("A:T").Select
Selection.Copy
ActiveWindow.WindowState = xlMinimized
Windows("plannification.xls").Activate
ActiveWindow.WindowState = xlMaximized
Sheets("bdp").Select
Range("a1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Workbooks.Open Filename:="O:\gti\libcompcde1.xls"
Columns("A:C").Select
Range("A563").Activate
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.WindowState = xlMinimized
Windows("plannification.xls").Activate
ActiveWindow.WindowState = xlMaximized
Sheets("libcomp").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("210100").Select
Cells.Select
Range("BS1").Activate
Selection.Copy
Sheets("210100S-1").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("210100").Select
Range("C4").Select
Application.CutCopyMode = False
With Selection.ListObject.QueryTable
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.PreserveColumnInfo = True
End With
ActiveWorkbook.RefreshAll
Range("Y2").Select
ActiveCell.FormulaR1C1 = _
"=IF(VLOOKUP(RC[-5],'210100S-1'!C[-5]:C[2],6,FALSE)=0,"""",VLOOKUP(RC[-5],'210100S-1'!C[-5]:C[2],6,FALSE))"
Range("Z2").Select
ActiveCell.FormulaR1C1 = _
"=IF(VLOOKUP(RC[-6],'210100S-1'!C[-6]:C[1],7,FALSE)=0,"""",VLOOKUP(RC[-6],'210100S-1'!C[-6]:C[1],7,FALSE))"
Range("AA2").Select
ActiveCell.FormulaR1C1 = _
"=IF(VLOOKUP(RC[-7],'210100S-1'!C[-7]:C,8,FALSE)=0,"""",VLOOKUP(RC[-7],'210100S-1'!C[-7]:C,8,FALSE))"
Dim LastLig As Long
With Sheets("210100") 'à adapter
LastLig = .Cells(.Rows.Count, "B").End(xlUp).Row 'Dernière cellule remplie de la colonne C
If LastLig > 2 Then .Range("Y2").AutoFill .Range("Y2:Y" & LastLig)
End With
With Sheets("210100") 'à adapter
LastLig = .Cells(.Rows.Count, "B").End(xlUp).Row 'Dernière cellule remplie de la colonne C
If LastLig > 2 Then .Range("Z2").AutoFill .Range("Z2:Z" & LastLig)
End With
With Sheets("210100") 'à adapter
LastLig = .Cells(.Rows.Count, "B").End(xlUp).Row 'Dernière cellule remplie de la colonne C
If LastLig > 2 Then .Range("AA2").AutoFill .Range("AA2:AA" & LastLig)
End With
End Sub |
Partager