Consulting

Results 1 to 6 of 6

Thread: Solved: VBE to change Line Chart Height based on number of Rows

  1. #1
    VBAX Mentor
    Joined
    Jan 2009
    Posts
    304
    Location

    Solved: VBE to change Line Chart Height based on number of Rows

    I have a Line Chart that uses Names Ranges as the Source(s) because the number of entries (rows) can vary greatly in my data set (anywhere from 10 to 100 entries/rows).

    How can I have the Line Chart expand down as more entries are entered?

    The Chart will show the new entries but you cannot read the Labels beacuse they are to small and appear almost on top of each other becasue the Chart does not "physically" expand down automatically.

    Is there a way to have a chart's physical "size" change automatically to allow for new entries so that the Labels are readable?

    ie: overall chart height = .x for each row, where x is a constant height setting?

    Thanks for any and all help...

    Jim

  2. #2
    VBAX Mentor
    Joined
    Jan 2009
    Posts
    304
    Location
    Anyone have any ideas?

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    A simple example saves us from having to create a workbook trying to replicate your problem.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    VBAX Mentor
    Joined
    Jan 2009
    Posts
    304
    Location
    Here's an example of the data.

    The number of rows can vary.

  5. #5
    VBAX Mentor tpoynton's Avatar
    Joined
    Feb 2005
    Location
    Clinton, MA
    Posts
    399
    Location
    here's one idea, but I'd like to see if a method exists that doesnt need to refer to the data sheet...

    [vba]
    Public Sub expandChartToRows()
    With ActiveSheet.ChartObjects(1)
    .Height = (ThisWorkbook.Sheets("Data1").UsedRange.Rows.Count + 10) * 14
    End With
    End Sub
    [/vba]

  6. #6
    VBAX Mentor
    Joined
    Jan 2009
    Posts
    304
    Location
    This will work - Thank you very much....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •