+ Reply to Thread
Results 1 to 9 of 9

Change Pivot Table Data Source to range A7: last record in F column

  1. #1
    Registered User
    Join Date
    03-31-2014
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    40

    Post Change Pivot Table Data Source to range A7: last record in F column

    Hello Everybody!

    Been having some trouble setting a new data source for a pivot table in VBA. Please refer to the code below for more details.


    Please Login or Register  to view this content.

    Any ideas? Thanks a lot everyone!

  2. #2
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Change Pivot Table Data Source to range A7: last record in F column

    Hi
    The first proble is the "F?" in your range. Correct this and see if it resolves your issue.
    Tony

  3. #3
    Registered User
    Join Date
    03-31-2014
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Change Pivot Table Data Source to range A7: last record in F column

    I'm aware that the F in the code is messing it up. It was just meant to be an example as opposed to actual code.

    A7 in the range is known and doesn't change, but the end value in the range does change. I need the code to read through the F column and find the last value Ex. F89, so the range for the new record source would then be A7:F89, but the F value will change.

    So I just need to know how to scan the F column for the last value and then plug it into the range for a new record source.

  4. #4
    Registered User
    Join Date
    03-31-2014
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Change Pivot Table Data Source to range A7: last record in F column

    Does anybody know how to do this?

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Change Pivot Table Data Source to range A7: last record in F column

    Something like this:
    Please Login or Register  to view this content.
    Last edited by romperstomper; 06-09-2014 at 08:23 AM. Reason: typo
    Remember what the dormouse said
    Feed your head

  6. #6
    Registered User
    Join Date
    03-31-2014
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Change Pivot Table Data Source to range A7: last record in F column

    Thank you for the reply! I put in your code and it says there is a syntax error? Any thoughts?

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Change Pivot Table Data Source to range A7: last record in F column

    Apologies - there was a missing quotation mark which I have now added.

  8. #8
    Registered User
    Join Date
    03-31-2014
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Change Pivot Table Data Source to range A7: last record in F column

    Thank you so much! The code works exactly how I wanted it! Great job!

  9. #9
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Change Pivot Table Data Source to range A7: last record in F column

    Glad to help. Please remember to mark the thread solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Pivot Table, use VBA to get use back to record in source data table
    By gr8tday in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-17-2014, 01:30 AM
  2. Macro to change pivot table range after importing new source data
    By kevinm3u in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-07-2014, 12:27 PM
  3. Pivot Table : Can't change source range
    By RED Rose in forum Excel General
    Replies: 0
    Last Post: 08-30-2010, 03:08 PM
  4. Replies: 1
    Last Post: 06-20-2010, 04:00 AM
  5. [SOLVED] Change the range of a pivot table data source
    By Tony White in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2005, 03:05 PM

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