+ Reply to Thread
Results 1 to 4 of 4

Macro: Pivot Table Ranges Vary

  1. #1
    Registered User
    Join Date
    07-20-2012
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 365
    Posts
    46

    Macro: Pivot Table Ranges Vary

    Hi!
    I am creating a macro and would like to add a pivot table. My table range will vary from file to file, how do I get the macro to select the range of cells that are populated on my sheet?
    Thanks!
    Tina

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Macro: Pivot Table Ranges Vary

    if you know the data will start in A1 then I would use sheets("sheetname").Range("A1").Currentregion
    if not you can use the UsedRange property of the sheet but this may occasionally include blank rows/columns.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    07-20-2012
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 365
    Posts
    46

    Re: Macro: Pivot Table Ranges Vary

    Thanks for the reply!
    Pretty new to VB, so given what was suggested, how would I write that in VB if it reads:

    Please Login or Register  to view this content.
    Thanks!
    Last edited by Cutter; 07-20-2012 at 09:38 PM. Reason: Added code tags

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Macro: Pivot Table Ranges Vary

    like this for instance
    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)

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