+ Reply to Thread
Results 1 to 6 of 6

Get Range last row and column for Pivot Table Range

  1. #1
    Registered User
    Join Date
    12-15-2014
    Location
    Wales, UK
    MS-Off Ver
    365
    Posts
    66

    Get Range last row and column for Pivot Table Range

    Good day,

    I'm trying to get the range to create a pivot table. The Column amounts can differ each month and the rows. My code is not working at the marked section (Red) and I believe the line after that won't either to create the Pivot table Range. Is there a better way to do it or to fix this code please?

    Please Login or Register  to view this content.
    Last edited by Simone Fick; 09-10-2017 at 05:25 PM. Reason: Solved

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Get Range last row and column for Pivot Table Range

    Hi Simone,

    Change the "xlToRight" to "xlToLeft" in your code and see if that then works.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    12-15-2014
    Location
    Wales, UK
    MS-Off Ver
    365
    Posts
    66

    Re: Get Range last row and column for Pivot Table Range

    Hi MarvinP,

    Unfortunately, it doesn't work. It still gives me an error on the same line. " Run time error '1004': Application defined or object defined error"

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Get Range last row and column for Pivot Table Range

    Try

    PvtRange = Worksheets("Active Instances").Range(Cells(RowsCount, ColCount))

  5. #5
    Registered User
    Join Date
    12-15-2014
    Location
    Wales, UK
    MS-Off Ver
    365
    Posts
    66

    Re: Get Range last row and column for Pivot Table Range

    It still gives the same error

  6. #6
    Registered User
    Join Date
    12-15-2014
    Location
    Wales, UK
    MS-Off Ver
    365
    Posts
    66

    Re: Get Range last row and column for Pivot Table Range

    I solved the problem with the following code:

    Please Login or Register  to view this content.

+ 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. [SOLVED] Change Pivot Table Data Source to range A7: last record in F column
    By johnstevens in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-09-2014, 08:35 AM
  2. sumifs on a pivot table - compare range with range
    By pavlos in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-30-2013, 02:26 AM
  3. Replies: 11
    Last Post: 07-18-2013, 05:14 PM
  4. Replies: 4
    Last Post: 10-10-2012, 03:38 PM
  5. Replies: 5
    Last Post: 08-30-2012, 06:50 AM
  6. Print Range for Pivot Table Adjusting Range
    By mmicfinance in forum Excel General
    Replies: 0
    Last Post: 08-08-2012, 01:55 PM
  7. Return pivot table range...not the data table, the PIVOT TABLE!
    By Air_Cooled_Nut in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-26-2008, 01:07 PM

Tags for this Thread

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