+ Reply to Thread
Results 1 to 6 of 6

Automate creation of charts

  1. #1
    Registered User
    Join Date
    12-17-2019
    Location
    Leeds, UK
    MS-Off Ver
    365
    Posts
    61

    Post Automate creation of charts

    Hi all,

    I have a spreadsheet of car park occupancy for each hour of the day across 5 car parks. The first 24 rows are hourly occupancies for Car Park A, the next for Car Park B, and so on.
    I want a chart of hourly occupancy for each of the 5 car parks in the spreadsheet and automate this process.
    I know I'd need a for loop which creates the first chart and then adds 24 rows to the chart's data array, but struggling to get my head around this.

    The code I have so far is as follows:
    Please Login or Register  to view this content.
    Any help would be hugely appreciated
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    251

    Re: Automate creation of charts

    Well first thing I noticed is you told the For Loop to count x from 0 to 5, but at the end of the loop, you add 24 to x, meaning it already exceeds 5 and ends the loop.

  3. #3
    Registered User
    Join Date
    12-17-2019
    Location
    Leeds, UK
    MS-Off Ver
    365
    Posts
    61

    Re: Automate creation of charts

    Thanks, I see what you mean. Should be "For x=1 To 5" and "x=x+1" but within the code, determining the chart series data could use a range of x*24-22 to x*24+1
    So for iteration 1 (x=1), 1*24-22 to 1*24+1 (i.e. row 2 to row 25)
    and for iteration 2 (x=2), 2*24-22 to 2*24+1 (i.e. row 26 to row 49)

    Just need the code that achieves that!

  4. #4
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    251

    Re: Automate creation of charts

    You might need to enable the Microsoft Scripting Runtime library to use the following macro. To do this, in the VBA editor goto Tools > References. Then scroll til you see "Microsoft Scripting Runtime library" and make sure it's checked. If already checked it will be at the top of the list with the other active references.

    Please Login or Register  to view this content.
    Hope this helps!

  5. #5
    Registered User
    Join Date
    12-17-2019
    Location
    Leeds, UK
    MS-Off Ver
    365
    Posts
    61

    Re: Automate creation of charts

    Hero, thanks very much

  6. #6
    Registered User
    Join Date
    04-30-2019
    Location
    US
    MS-Off Ver
    365
    Posts
    12

    Re: Automate creation of charts

    Less complicated than using a dictionary:

    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. Automate Record Creation
    By Nevada_7 in forum Excel General
    Replies: 3
    Last Post: 07-13-2020, 02:56 AM
  2. How to Automate the Creation of PPT
    By balajisx in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-28-2017, 10:58 AM
  3. Automate creation of monthly invoices
    By curious1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-06-2006, 02:31 AM
  4. [SOLVED] automate creation of sheets in excel
    By JE McGimpsey in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 07:05 AM
  5. [SOLVED] automate creation of sheets in excel
    By Daniel in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  6. [SOLVED] automate creation of sheets in excel
    By Daniel in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  7. [SOLVED] HOW DO I AUTOMATE CREATION OF JOB SHEETS?
    By bobby smith in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-14-2005, 08:05 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