+ Reply to Thread
Results 1 to 2 of 2

Macro to Make Chart out of Variable Ranges in a Table

  1. #1
    Registered User
    Join Date
    02-05-2014
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    4

    Macro to Make Chart out of Variable Ranges in a Table

    I am new to Excel VBA and am trying to figure out how I can write VBA code to create a chart (a 2D Line with Markers chart) based on a table which will always have the same number of columns (A:G) but vary in the number of rows (8 to 10, 8 to 100, 8 to 1200, etc.).

    I can't figure out how to get the chart to dynamically choose the number of rows for chat data based on the last row with data in it.

    See attached image.

    Any help? Thanks in advance!
    Attached Images Attached Images

  2. #2
    Registered User
    Join Date
    09-01-2010
    Location
    SoCal
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Macro to Make Chart out of Variable Ranges in a Table

    Hello Quepes.

    In your example, I would turn the grid into an actual "Table".

    Select cell "A8".
    From the menu ribbon, select INSERT/TABLE. Click the box My table has headers. Ok.

    Now click from the ribbon, INSERT /LINE (choose the appropriate line graph).

    the Resulting Graph is now Dynamically linked to the table.
    If the table stretches, so does the graph.
    If the the table shrinks, so does the graph.

    Note that your row 8 will be the titles on the graph, so label them accordingly.

+ 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. Help to Make a Macro Dynamically Paste a Defined Table is a Specified Variable is Given
    By Jason.eschberger in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-06-2013, 02:34 PM
  2. Creating a chart with multiple data-sources that have variable ranges ( in VBA)
    By Brocktanor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-05-2013, 02:07 PM
  3. make a chart range variable
    By alex520 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-29-2012, 05:14 AM
  4. Replies: 1
    Last Post: 04-10-2011, 09:51 PM
  5. [SOLVED] Counting variable ranges and auto-summing variable ranges
    By Father Guido in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2006, 11:10 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