Results 1 to 5 of 5

Copy Chart from one area to another without fixed cells

Threaded View

  1. #5
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Copy Chart from one area to another without fixed cells

    Everything you ever wanted to know about dynamic charting is contained in these two articles.

    http://www.utteraccess.com/wiki/inde...Dynamic_Ranges
    http://www.utteraccess.com/wiki/inde...namic_Charting

    I will regurgitate some of the content here as applied to the specifics of this requirement.

    I created a sheet called dashboard to select the customer and to display the chart.

    Cell B1 has a List-type data validation using a named dynamic range called
    Customer_List which is defined as =OFFSET(Data!$A$2,0,0,COUNTA(Data!$A:$A)-1,1).

    The offset command, done “from scratch” has 5 arguments
    - Start cell
    - Rows to go down
    - Columns to go right
    - Number of rows to return
    - Number of columns to return

    So this range points to the following:
    - Start in Cell A2 on the data sheet
    - Go down zero rows and over zero columns (so we are still in A2)
    - Return a range COUNTA(A:A)-1 rows deep and 1 column wide

    The reason for the minus 1 in the COUNTA is that we don’t want to count the header column. With the date provided, this works out to Data!A2:A5. As you add or delete customers to Column A, the dynamic range will change to cover them.

    I assumed that the X-axis of your chart is fixed to 12 months and that you will probably be copying and pasting data in. This range is defined as My_Date and it is set to =Data!$D$1:$O$1

    The easiest way to set a fixed range is to highlight the range, go to the name box (upper left, below the menu, next to the formula box – it normally shows the topmost, leftmost cell selected) – then type in the name you want to assign. Or you can use the name manager and add it that way.

    This brings us to the parameters sheet. I use a parameter sheet to do “scratch” calculations. It contains helper cells and intermediate calculations that keep future calculations from getting too complex.

    The parameters sheet can be hidden if you wish.

    Cell B1 on the parameter page merely reflects the named range Customer_Name. I assigned this static name to Cell B1 on the Dashboard sheet since I anticipated using it in several places in the workbook.

    Cell B2 contains the formula: =MATCH(B1,Data!A:A,0). This formula gets the physical row on the Data sheet on which is found the customer name.

    Cell B3 also reflects Customer_Name. I use this cell for the chart title. You may want to concatenate it with some other text, perhaps something reflecting the date range, for a fancier title.

    There is one final dynamic range: My_Value =OFFSET(My_Date,Parameters!$B$2-1,0)

    From scratch, the offset command has 5 arguments. However, you can also use offset to define a new range in terms of an existing range.

    In this case we want to get the value of Cell B2 on the parameters sheet (which varies based on the customer selected) and go down that many rows minus 1 and shift over zero columns. The reason for the -1 is that MATCH starts counting from 1 whereas OFFSET starts counting from zero.

    So if we select Customer B, Match tells us it’s on row 3. So the value range to plot is 2 rows below My_Date and zero columns over.

    My_Date and My_Value are plotted on the chart using the techniques in the article referenced above.

    So when you select a customer, it changes the Match that changes the offset that changes the row that the chart looks at to plot.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Fixed Position Cells or Chart
    By DauntlessDS in forum Excel General
    Replies: 4
    Last Post: 02-08-2015, 03:43 PM
  2. Trying to copy fixed row of cells, paste to next empty line, and clear fixed line.
    By oh_stanley in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-24-2014, 07:44 PM
  3. 3D area chart; how to copy value axis.
    By akj1944 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 11-05-2013, 07:17 AM
  4. Replies: 1
    Last Post: 02-12-2013, 12:16 PM
  5. Area chart and empty cells
    By uttumi in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 12-26-2012, 05:23 AM
  6. Replies: 0
    Last Post: 07-12-2010, 09:56 AM
  7. [SOLVED] copy chart area
    By Vik in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-02-2005, 06:05 AM

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