+ Reply to Thread
Results 1 to 5 of 5

VBA code to move shape on overlapping bar chart to the end of the data series

  1. #1
    Registered User
    Join Date
    05-11-2008
    MS-Off Ver
    2010
    Posts
    91

    VBA code to move shape on overlapping bar chart to the end of the data series

    I have a bar chart with 3 overlapping values. Since it is overlapping there are certain bars that can't be seen so I have created a right bracket shape and dragged it to the end of the bar that is being covered up to show where the bar ends. Doing this manually is very time consuming and takes a very steady hand. Is there a way to accomplish this using VBA? I have attached a sample graph. So for example on the graph Category A is currently being covered up by Category B and C due to the order of which the bars are written in Excel. So to show where Category A Value1 (4) ends, I have created the right bracket and dragged and positioned it to the 4 spot on the chart. I have tried the macro recorder while moving the shape around and I can see the Selection.ShapeRange.IncrementLeft code, for example, being displayed, but this just seems like it's moving the shape left/right/up/down from the location where the shape originally was. Is there code that will move the shape and line it up with the bar to the value that is specified on the table to the left (i.e. cell B6)? I currently manage a bigger version of this chart that I update monthly where I am manually doing this with a steady hand and it is killing my brain cells. Any input or help is much appreciated. Thanks!
    Attached Files Attached Files

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

    Re: VBA code to move shape on overlapping bar chart to the end of the data series

    hi,

    the code to move the shape would be like this:

    Please Login or Register  to view this content.
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  3. #3
    Registered User
    Join Date
    05-11-2008
    MS-Off Ver
    2010
    Posts
    91

    Re: VBA code to move shape on overlapping bar chart to the end of the data series

    In your code, what does the Range("L5").Top represent? It doesn't make sense if it's referencing cell L5 because that cell is blank. Also specifically what does the .Top code represent? Thanks!

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

    Re: VBA code to move shape on overlapping bar chart to the end of the data series

    it will align your shape to the top of the cell L5.

    Top & Left are the position values.

  5. #5
    Registered User
    Join Date
    05-11-2008
    MS-Off Ver
    2010
    Posts
    91

    Re: VBA code to move shape on overlapping bar chart to the end of the data series

    Is there a way to align the shape to a specific spot on the graph such as the end of a data series?

+ 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] Align Line Chart's data series Data labels on top of Bar chart data series
    By rgunlimited in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-01-2014, 10:38 AM
  2. Chart: move Y value for all data series
    By dourpil in forum Excel General
    Replies: 1
    Last Post: 05-21-2014, 11:15 AM
  3. Replies: 4
    Last Post: 01-02-2012, 04:52 PM
  4. Chart data from pivot table using overlapping years
    By SueWithQuestion in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-18-2011, 12:20 PM
  5. [SOLVED] Using VBA code to change Chart Data Series
    By WilliamI in forum Excel General
    Replies: 1
    Last Post: 08-30-2005, 11: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