|
让调试不会调试。。。
Sub 透视表5()
'
' 透视表5 Macro
'
'
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"081!R1C1:R1200C16", Version:=xlPivotTableVersion10).CreatePivotTable _
TableDestination:="Sheet1!R3C1", TableName:="数据透视表1", DefaultVersion:= _
xlPivotTableVersion10
Sheets("Sheet1").Select
Cells(3, 1).Select
With ActiveSheet.PivotTables("数据透视表1").PivotFields("商品产地")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("数据透视表1").PivotFields("客户名称")
.Orientation = xlRowField
.Position = 2
End With
With ActiveSheet.PivotTables("数据透视表1").PivotFields("商品名称")
.Orientation = xlRowField
.Position = 3
End With
With ActiveSheet.PivotTables("数据透视表1").PivotFields("数量")
.Orientation = xlRowField
.Position = 4
End With
With ActiveSheet.PivotTables("数据透视表1").PivotFields("单位")
.Orientation = xlRowField
.Position = 5
End With
With ActiveSheet.PivotTables("数据透视表1")
.ColumnGrand = False
.RowGrand = False
End With
ActiveSheet.PivotTables("数据透视表1").ShowDrillIndicators = False
ActiveSheet.PivotTables("数据透视表1").PivotFields("单据类型").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("单号").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("单据状态").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("单据日期").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("成本单价").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("部门名称").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("客户名称").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("商品产地").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("商品名称").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("数量").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("单位").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("商品编号").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("单价").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("金额").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("毛利").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
ActiveSheet.PivotTables("数据透视表1").PivotFields("交货地点").Subtotals = Array(False, _
False, False, False, False, False, False, False, False, False, False, False)
With ActiveSheet.PivotTables("数据透视表1").PivotFields("商品产地")
.PivotItems("").Visible = False
.PivotItems("(空白)").Visible = False
End With
Cells.Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = True
.ReadingOrder = xlContext
.MergeCells = False
End With
ActiveSheet.PivotTables("数据透视表1").PivotSelect "商品名称[All]", xlLabelOnly, True
Rows("1:2").Select
Selection.Delete Shift:=xlUp
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(3.93700787401575E-02)
.RightMargin = Application.InchesToPoints(3.93700787401575E-02)
.TopMargin = Application.InchesToPoints(3.93700787401575E-02)
.BottomMargin = Application.InchesToPoints(3.93700787401575E-02)
.HeaderMargin = Application.InchesToPoints(0.31496062992126)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 180
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
ActiveSheet.PivotTables("数据透视表1").PivotSelect "单位[All]", xlLabelOnly, True
Columns("G:K").ColumnWidth = 0
Columns("F:F").ColumnWidth = 0.15
Columns("A:A").ColumnWidth = 9.25
Columns("B:B").ColumnWidth = 14
Columns("C:C").ColumnWidth = 7.75
Columns("D:D").ColumnWidth = 4.88
Columns("E:E").ColumnWidth = 3.75
Columns("B:B").ColumnWidth = 13.63
Columns("B:B").ColumnWidth = 13.5
Range("A2:E137").Select
Range("B3").Activate
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
ActiveWindow.SmallScroll Down:=-24
Application.ActivePrinter = "Brother MFC-7360 Printer 在 Ne07:"
ExecuteExcel4Macro _
"PRINT(1,,,1,,,,,,,,2,""Brother MFC-7360 Printer 在 Ne07:"",,TRUE,,FALSE)"
End Sub
|
|