Excel VBA help

  VNAM75 16:59 19 Dec 2008
Locked

I recorded a macro which opens up the details of a record line in a pivot table. The code is

Range("A6").Select

ActiveSheet.PivotTables("PivotTable1").PivotFields("ShipName").PivotItems( _"UK").ShowDetail = True

Is it possible to alter the code so that rather than opening "UK" records, it gives me a prompt box to type in any country and opens the relevant records. I also need it to move to the first line of the opened records.

If a prompt box is not possible, a reference to a cell would be OK, eg. cell A1 could replace the prompt box.

  VoG II 17:16 19 Dec 2008

Try

Dim Country As String
Country = InputBox("Enter country")
ActiveSheet.PivotTables("PivotTable1").PivotFields("ShipName").PivotItems(Country).ShowDetail = True


As to moving to the first item, recording a macro might give you some code.

  VNAM75 17:23 19 Dec 2008

Thanks a lot again VoG™!

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

OnePlus 5 review

Alice Saey's mesmerising animation for Dutch singer Mark Lotterman

iPad Pro 10.5in (2017) review

Comment booster votre iPhone ?