|
저도 초보라.....아래 코드를 참고하세요...
그럼 도움이 되셨길...
Sub 피벗테이블1()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
ActiveWorkbook.Names.Add "자료", Sheets("데이타").Range("a1").CurrentRegion
Sheets("피벗").Select
Cells.Select
Selection.Delete Shift:=xlUp
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"자료").CreatePivotTable TableDestination:=Sheets("피벗").Range("A1"), TableName _
:="피벗 테이블"
ActiveSheet.PivotTables("피벗 테이블").SmallGrid = False
ActiveSheet.PivotTables("피벗 테이블").AddFields RowFields:="종목", ColumnFields _
:="펀드"
ActiveSheet.PivotTables("피벗 테이블").PivotFields("수량").Orientation = xlDataField
Range("H22").Select
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
|
|