- ©«¤l
- 38
- ¥DÃD
- 12
- ºëµØ
- 0
- ¿n¤À
- 122
- ÂI¦W
- 0
- §@·~¨t²Î
- winxp
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- na
- µù¥U®É¶¡
- 2010-7-31
- ³Ì«áµn¿ý
- 2024-5-13
|
¦^´_ 6# kimbal
§Ú´ú¸Õªºµ²ªG¤£¦æ,§Ú¼gªºµ{¦¡¦p¤U: (½Ð°Ý§Ú¸Õþ¸Ì¥X°ÝÃD¤F©O, range("n2")=TRANSDT,range("o2")=CHAMID
Dim r As Single
Dim a1 As Range
Dim a2 As Range
Set a1 = Range("N2") 'row field
Set a2 = Range("O2") 'column field
r = [F65536].End(xlUp).Row
Set ptcache = ThisWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:="total glass!R1C2: R3030C12")
Set pt = ptcache.CreatePivotTable(TableDestination:="", TableName:="pivottable1")
With pt
.PivotFields(Range("N2")).Orientation = xlColumnField
.AddDataField pt.PivotFields("DEFQTY"), "defect ¼Æ", xlSum
.AddDataField pt.PivotFields("CHAMID"), "glass ¼Æ", xlCount
.CalculatedFields.Add "density", "DEFQTY/CHAMID"
.PivotFields("density").Orientation = xlDataField
.Caption = " density"
.PivotFields(Range("O2")).Orientation = xlRowField
.PivotFields("CHAMID").Position = 1
End With
End Sub |
|