+ Reply to Thread
Results 1 to 9 of 9

Copy Range in a Pivot Table

  1. #1
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Copy Range in a Pivot Table

    I am trying to copy one specific cell in a pivot table. Below is what I have, but it is getting hung up on the final line with a run-time object-defined error. Why am I getting this error?

    Note: The range names in the pivot table were copied directly from the pivot table, so they are guaranteed to be accurate.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copy Range in a Pivot Table

    There doesn't appear to be a destination for the copy.

    Unless it's Range("H27") and there's a typo.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: Copy Range in a Pivot Table

    It is supposed to paste the value to Range("H27"). Where is the typo? If it's the space after Range, VBA is automatically adding that when I hit enter
    Last edited by Gard5096; 01-30-2013 at 04:00 PM.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copy Range in a Pivot Table

    This is all one long statement, apart from ("H27").
    Please Login or Register  to view this content.
    There should be space between Copy and .Range("H27").
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: Copy Range in a Pivot Table

    Ok so now it is giving me a new error "Object Required". Do you think I need to use something like:

    Please Login or Register  to view this content.
    ...athogh this gives me an error as well

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copy Range in a Pivot Table

    To be honest I'm not sure what you need exactly, not really used this method to get a value from a pivot table

    One thing you should probably do is split that line of code up and use a range variable.
    Please Login or Register  to view this content.
    This way you can check which part is actually causing the error.

    I think it might be worth attaching a workbook.

  7. #7
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: Copy Range in a Pivot Table

    I have attached a sample. I really just want to copy the value from a single cell in a pivot table, and paste it in a different location.
    Attached Files Attached Files

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copy Range in a Pivot Table

    Try this.
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: Copy Range in a Pivot Table

    Norie, I was still having problems because there are actually multiple column headers. I found that using the intersect method worked great.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1