简体   繁体   English

Excel VBA:如何选择所有图表并将其大小更改为不同但统一的大小?

[英]Excel VBA: How can I select all of my Charts and change their sizes to a different, yet uniform size?

The problem: I've got a large file containing about 250 charts, I've been formatting the charts with code looking like this= 问题:我有一个大文件,其中包含约250张图表,我一直在使用如下代码格式化图表:

         With chrt
            .SetSourceData Source:=rChartData.Offset(0, 1).Resize(, 3)

            .SetElement msoElementChartTitleCenteredOverlay
            .ChartTitle.Caption = cl.Value

            .PlotArea.Height = .PlotArea.Height - .ChartTitle.Height
            .PlotArea.Top = .PlotArea.Top + .ChartTitle.Height

            .SeriesCollection(1).Name = "=""Measured"""
            .SeriesCollection(2).Name = "=""Modeled"""

            .SeriesCollection(1).MarkerStyle = -4142
            .SeriesCollection(2).MarkerStyle = -4142

            .Axes(xlCategory).MinimumScale = 14650
            .Axes(xlCategory).MaximumScale = 40000
            .Axes(xlCategory).MajorUnit = 1800
            .Axes(xlCategory).MinorUnitIsAuto = True

            .SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
                .Axes(xlCategory).AxisTitle.Text = "Stress Periods"
            .SetElement (msoElementPrimaryValueAxisTitleRotated)
                .Axes(xlValue, xlPrimary).AxisTitle.Text = "Cubic Feet/Sec"

       End With

Then it goes on its merry loop to finish the other 249 charts. 然后它继续前进,完成其他249张图表。 But I also need all of them to be larger than the default size Excel gives me. 但是我还需要所有这些都大于Excel给我的默认大小。 What is the correct code terminology to extend my chart to a larger size such as this from A to B? 什么是将我的图表扩展到更大的尺寸(例如,从A到B)的正确代码术语?

在此处输入图片说明

我找到了要添加到伞式With语句的属性:

          .ChartArea.Width = [desired width, IN POINTS, of the object]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Excel VBA for Mac 中将多个图表调整为不同大小? - How can I resize multiple charts to different sizes in Excel VBA for Mac? 如何使用 Excel 或 VBA 为不同的数据打印不同的图表? - How can I print different charts for different data with Excel or VBA? 更改工作表 VBA Excel 中所有图表的字体大小 - Change font size of all charts in worksheet VBA Excel 如何在VBA中选择并复制excel的不同部分以实现excel? - How do I to select and copy different parts of excel to excel in VBA? 如何在Excel中为所有图表分配随机名称? - How can I assign a random name to all charts in excel? 如何在不选择形状的情况下使用VBA更改Excel中的文本大小? - How can I change the text size in Excel using VBA without selecting the shape? Excel VBA 有没有办法为工作表中的所有条形图更改 excel 条形图(只有一种颜色)的条形图 colors - Excel VBA Is there a way to change the bar colors for excel bar charts (just one color) for all bar charts in sheet 如何针对我的 Excel 工作表的所有行运行我编写的 vba? - How can I run a vba I wrote against all of the rows of my excel sheet? 如何在VBA、Excel中复制和选择图表、图片等 - How to Copy and Select Charts, Pictures, etc. in VBA, Excel 在excel vba中选择纸张尺寸(非默认尺寸) - Choosing paper size (NOT DEFAULT sizes) in excel vba
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM