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