Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jun 2003
    Location
    london, Gtr London, England
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pivot Tables - Referring to Values in Cells (Excel VBA/ Excel 2000)

    I wonder if you can help.

    I am trying to write some VBA code to refer to the data values in specific cells in a pivot table. I know how to refer to specific pivot fields, specific pivot items but not specific cells.

    For example if you had a pivot table in which the row heading was country and the column heading status, how would you refer to the cell of data corresponding to say, country = Germany and status = C. I have attached some example data.

    Regards
    Tim

  2. #2
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Pivot Tables - Referring to Values in Cells (Excel VBA/ Excel 2000)

    Would it be dumb to just use Range("D6")?
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Pivot Tables - Referring to Values in Cells (Excel VBA/ Excel 2000)

    You can use the GetPivotData method of the PivotTable object for this:

    MsgBox ActiveSheet.PivotTables(1).GetPivotData("Value", "Country", "Germany", "Status", "C")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •