+ Reply to Thread
Results 1 to 4 of 4

how to create vertical line in excel for multiple charts/multiple y ranges

  1. #1
    Registered User
    Join Date
    10-13-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    2

    how to create vertical line in excel for multiple charts/multiple y ranges

    I am trying to add in vertical lines to my line charts to represent an important data/event, and the way I went about doing so was adding in the max value of the y range for the specific date as seen below and making it into a bar chart.

    But the problem is I have over 22 charts that I want to have these vertical lines on, and all of them have different y ranges.

    What ends up happening is the lines look either too short or in the case in the bottom chart, go off range to make the data look too small/unviewable.

    Does anyone know any other solutions for adding in vertical lines like seen below, but a solution that doesn't require me to make a unique vertical line for each chart?vertical date lines_offscale.jpg

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: how to create vertical line in excel for multiple charts/multiple y ranges

    Whatever methodology you are using to determine the value of 1,400,000 should be amended to set the value equal to the next multiple of 200k above the maximum value in your key data column.

    This formula does that in a cell: =CEILING(MAX(A:A), 200000)

    Now use that approach in VBA to detect the maximum value in your key data column, then move it up to the next 200k. That should keep your data from being smashed when the lines are later added.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    10-13-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    2

    Re: how to create vertical line in excel for multiple charts/multiple y ranges

    Hi JBeaucaire,

    How would I apply that solution to multiple charts (22) if the y axis has different ranges? Wouldn't I have to use a unique "max ceiling" forumla for each chart? I am looking for a solution that can be applied to all the charts at once if possible.

    Best,
    Michelle

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: how to create vertical line in excel for multiple charts/multiple y ranges

    Yes, the code you create to apply to your charts would need to find the MAX value in that key column and adjust it using the CEILING approach. That can be done in VBA.

+ 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. [SOLVED] Loop through ranges to create multiple charts
    By Strup in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2014, 09:58 AM
  2. stock chart: create multiple short vertical line
    By DavidRoger in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 01-05-2014, 08:52 PM
  3. Adding Vertical Line to the Excel charts
    By booo in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-19-2012, 06:48 PM
  4. Replies: 1
    Last Post: 06-04-2010, 03:51 AM
  5. [SOLVED] How to create vertical line charts
    By Henrik in forum Excel General
    Replies: 4
    Last Post: 05-06-2006, 09:30 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