+ Reply to Thread
Results 1 to 4 of 4

Change chart source data range

  1. #1
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Change chart source data range

    Something about charting VBA that drives me nuts!!!

    I'm attempting to change the range callout for a chart range.

    In the following code the hard-coded range in the 1st instance of .Chart.SetSourceData........ works great, however i need the flexibility to expand/contract the range of cells, hence the routine below to capture the row number in column F with values greater than zero. I should note that the database has been sorted such that the order of cells in column F is in descending order.

    The intent was then to use the icount variable in the range callout for the chart range.

    The strange thing is i get an error message, Run-time error '1004': but the code appears to change the range correctly but then i need to abort the remainder of the code, any help would be appreciated.


    Please Login or Register  to view this content.
    Last edited by jprlimey; 06-06-2015 at 10:51 AM. Reason: Solved

  2. #2
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Change chart source data range

    Hi,

    change this line of code :
    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    as icount is a variable.
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  3. #3
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: Change chart source data range

    Changing the line of code to below, didn't work. Meaning i did something but it expanded the range across many columns.

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: Change chart source data range

    I have fixed my problem with the code below. The point of interest was to change the category axis range only, the code below achieved this.


    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. Excel 2007 : Copy chart, change data source
    By Mimil in forum Excel General
    Replies: 5
    Last Post: 02-03-2011, 08:08 AM
  2. Not able to change Excel chart data source
    By booo in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 10-21-2010, 02:15 PM
  3. Change Data Source of Pivot Chart
    By riluma in forum Excel General
    Replies: 1
    Last Post: 07-16-2010, 01:25 PM
  4. Excel 2007 : Change chart source data in XL2007
    By normc in forum Excel General
    Replies: 2
    Last Post: 12-31-2009, 05:07 PM
  5. change Line Chart source data in VB
    By Centurian77 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 03-20-2005, 12:52 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