+ Reply to Thread
Results 1 to 4 of 4

macro where array varies

  1. #1
    Registered User
    Join Date
    12-12-2006
    Posts
    63

    macro where array varies

    Hi, I have recorded a macro where the end result is a pivot table being produced. The array of cells that the pivot table reads from can vary in size. How can I get around this?

    any help much appreciated
    Liam

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Depending on your sheet set up, you can use CurrentRegion or UsedRange. Look at the VBA help for explanations.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Does the array size vary only in rows, or both rows and columns? Either way, you could create a dynamic named range that will update as the data is added. The pivot could use the named range (only need to create once) and can be refreshed by the macro to incorporate the additional data.


    rylo

  4. #4
    Registered User
    Join Date
    12-12-2006
    Posts
    63
    hi, the array varies in the number of rows. It will be a different spreadsheet and different data each time the macro is run. Just the data format, in this case 3 columns and varying number of rows, will be the same.

    Bear in mind I'm inexperienced with VB, although I can usually see where I need to add things into the module.

    thanks
    Liam

+ 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