0% found this document useful (0 votes)
18 views3 pages

Creer Formater TCD

The document contains two macros for Excel automation. Macro1 deletes a column, creates a table from a specified range, and generates a pivot table with specific fields and formatting. Macro2 adjusts font styles, alignment, and column widths for a selected range and applies a pivot table style.

Uploaded by

tlahou
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

Creer Formater TCD

The document contains two macros for Excel automation. Macro1 deletes a column, creates a table from a specified range, and generates a pivot table with specific fields and formatting. Macro2 adjusts font styles, alignment, and column widths for a selected range and applies a pivot table style.

Uploaded by

tlahou
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Sub Macro1()

'
' Macro1 Macro
'

'
Columns("F:F").Select
Selection.Delete Shift:=xlToLeft
Range("A2").Select
Selection.End(xlDown).Select
'Rows("1694:1694").Select
'Selection.Delete Shift:=xlUp
Range("D1682").Select
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$H$1693"), , xlYes).Name =
_
"Tableau1"
Range("A1:H1693").Select
ActiveSheet.ListObjects("Tableau1").TableStyle = "TableStyleMedium22"
Range("D12").Select
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Tableau1", Version:=xlPivotTableVersion10).CreatePivotTable _
TableDestination:="Feuil1!L3C1", TableName:="Tableau crois� dynamique1", _
DefaultVersion:=xlPivotTableVersion10
Sheets("Feuil1").Select
Cells(3, 1).Select
With ActiveSheet.PivotTables("Tableau crois� dynamique1").PivotFields("Client")
.Orientation = xlColumnField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau crois� dynamique1").PivotFields( _
"D�signation")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau crois� dynamique1").PivotFields("Date")
.Orientation = xlRowField
.Position = 2
End With
With ActiveSheet.PivotTables("Tableau crois� dynamique1").PivotFields("N.Doc")
.Orientation = xlRowField
.Position = 3
End With
ActiveSheet.PivotTables("Tableau crois� dynamique1").AddDataField ActiveSheet.
_
PivotTables("Tableau crois� dynamique1").PivotFields("Quantit�"), _
"Somme de Quantit�", xlSum
ActiveSheet.PivotTables("Tableau crois� dynamique1").PivotFields( _
"Somme de Quantit�").Caption = "Sortie du 01/09 � ce jour"
End Sub

Sub Macro2()
'
' Macro2 Macro
'

'
Columns("A:R").Select
With Selection.Font
.Name = "Arial"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("E7").Select
ActiveSheet.PivotTables("Tableau crois� dynamique1").TableStyle2 = _
"PivotStyleMedium9"
ActiveSheet.PivotTables("Tableau crois� dynamique1").ShowTableStyleRowStripes _
= True
ActiveSheet.PivotTables("Tableau crois� dynamique1"). _
ShowTableStyleColumnStripes = True
Rows("4:4").Select
With Selection
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.RowHeight = 55.5
Columns("D:D").ColumnWidth = 22.29
Columns("D:D").ColumnWidth = 20
Columns("E:E").ColumnWidth = 20.43
Range("F1").Select
Columns("F:F").ColumnWidth = 17.14
Columns("G:G").ColumnWidth = 16.14
Columns("H:H").ColumnWidth = 18.29
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
Columns("I:I").ColumnWidth = 19.86
Columns("J:J").ColumnWidth = 19.14
Columns("K:K").ColumnWidth = 19.29
Columns("L:L").ColumnWidth = 16.71
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 8
Columns("M:M").ColumnWidth = 20.57
Columns("N:N").ColumnWidth = 19.14
Columns("O:O").ColumnWidth = 26.14
Columns("O:O").ColumnWidth = 21.29
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 10
Columns("P:P").ColumnWidth = 21.57
Columns("P:P").ColumnWidth = 18.14
Columns("Q:Q").ColumnWidth = 20.71
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("A1").Select
End Sub

You might also like