+ Reply to Thread
Results 1 to 8 of 8

Change size of all graphs

  1. #1
    Registered User
    Join Date
    03-16-2016
    Location
    Berlin
    MS-Off Ver
    MS Office 2013
    Posts
    28

    Question Change size of all graphs

    Hello everybody,

    I am very new to this forum and only have a little bit of VBA skills, however, I hope you could help me something, which I am sure is very easy for you.

    I have a excel workbook with a lot of different graphs, which I need for a presentation.
    I would like to have a macro that makes all graphs the same size.
    I was thinking about 2 cells where I can put the width and the height in cm and then a button which I can press to change all the sizes.
    Is that possible?

    You would help me a lot! Really appreciate your time and effort!

    Best,
    Aden

  2. #2
    Registered User
    Join Date
    03-16-2016
    Location
    Berlin
    MS-Off Ver
    MS Office 2013
    Posts
    28

    Re: Change size of all graphs

    UPDATE:::


    Hello everybody,

    So I tried my best till know and it almost works.

    However, till now it only works for the active sheet but I would want the charts from the whole workbook to be the same size?

    Please Login or Register  to view this content.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Change size of all graphs

    Chart dimensions in VBA are in Dots Per Inch (DPI). To convert your input centimeters to DPI, convert cm to inches and then to DPI. The inches to DPI conversion factor is dependent on your particular display or printer.

    In the example below, my display has 96 DPI with a 150% scaling factor. So I multiply inches by 96 and then divide by 2 for my scaling. Your display will likely be different.

    The width and height input centimeters are in cells B1 and B2 on Sheet1. You can change those input cells to suit.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Change size of all graphs

    Hi there,

    See if the following code does what you need:

    Please Login or Register  to view this content.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  5. #5
    Registered User
    Join Date
    03-16-2016
    Location
    Berlin
    MS-Off Ver
    MS Office 2013
    Posts
    28

    Re: Change size of all graphs

    That works perfectly!

    Thank you so much Greg!!!!

  6. #6
    Registered User
    Join Date
    03-16-2016
    Location
    Berlin
    MS-Off Ver
    MS Office 2013
    Posts
    28

    Re: Change size of all graphs

    Thank you for your quick answer!!!!!

    I am not sure if I got that 100%. That means I might optimize the macro for my monitor, however, if I would send it to a collegeau if wouldn't work anymore?

  7. #7
    Registered User
    Join Date
    03-16-2016
    Location
    Berlin
    MS-Off Ver
    MS Office 2013
    Posts
    28

    Re: Change size of all graphs

    I found the answer!!!


    Application.CentimetersToPoints(Worksheets("Template").Range("J4").Value)


    Thank you all!

  8. #8
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Change size of all graphs

    Hi again,

    Many thanks for your feedback - glad I was able to help.

    Best regards,

    Greg M

+ 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. Change font size keeping the cell size fixed
    By mayurpatil in forum Excel General
    Replies: 1
    Last Post: 07-09-2015, 01:52 PM
  2. Question re: automating graphs to shrink in size
    By SolarFirst in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-23-2013, 05:51 AM
  3. Graphs in sheets distorted in size
    By DaniilK in forum Excel General
    Replies: 2
    Last Post: 11-08-2009, 07:12 PM
  4. Scatter Graphs + dynamically increase marker size?
    By fergalc in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 01-15-2007, 10:19 PM
  5. [SOLVED] How do you keep charts - graphs the same size?
    By datamonkey in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-24-2006, 09:00 AM
  6. [SOLVED] Making mutiple graphs the same size
    By merritaf in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 10-28-2005, 10:05 PM
  7. Excel graphs: window size of yy axis title
    By José Santos in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 04-23-2005, 11:08 PM

Tags for this Thread

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