Excel VBA質問スレ Part7at TECH
Excel VBA質問スレ Part7 - 暇つぶし2ch821:y
08/08/14 21:43:08
ピボットテーブルで処理する例です。

Sub ch_pivot()
Dim item As PivotItem, kName As String
kName = InputBox("顧客名を入力してください")
With Sheets("Sheet2")
With .PivotTables("ピボットテーブル1")
.PivotCache.Refresh
.PivotFields("顧客").PivotItems(kName).Visible = True
For Each item In .PivotFields("顧客").PivotItems
If item.Name <> kName Then item.Visible = False
Next
End With
Range(.Cells(5, 1), .Cells(.Rows.Count, 3).End(xlUp)).Copy _
Destination:=Application.InputBox("貼り付け先を指定してください", Type:=8)
End With
End Sub


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch