How does Excel set the size of the axis title to the alignment area? Office party and Student party often use Excel to do a lot of pictures, do ppt when these figures need to align, if the size of each plot is different, or the plot area rectangle size is inconsistent, axis title position is not uniform, how to put all feel where there is no alignment. Because of Excel's powerful data processing ability and popularity usage, white still insists on drawing with Excel. Time is valuable, as a layman, we do not need to understand a lot, enough can be, the following is small white with VBA simple to achieve the above functions, the above figure modified to the following figure. Together with you to learn Excel drawing, Master please a lot of advice.
1, the establishment of "Personal Macro Workbook":
A Personal Macro workbook is an Excel file, when we set up a Personal macro workbook, each time we open the Excel file, it automatically opens in the background and hides (can be hidden in the "view"), we can put all the macros in the "Personal Macro Workbook", So we don't have to save Excel as a file that contains macros.
such as the "development tool" of the graph point (if not, can be found in the custom Ribbon, click "Record Macro", pop-up "record Macro dialog" in the "Save in" drop-down menu select "Personal Macro Workbook", click "OK", and then click "Stop Recording." The first macro and Personal Macro workbook is complete.
2. Write macro file:
Open an Excel file, click the "development tool" "VisualBasic" pop-up VB interface, in the left of the "Project Explorer" tree (if not, please in the VB Interface Point "View" to find), we saw two items, the first project "PERSONAL.XLSB" is automatically open the hidden Personal Macro Workbook, double-click "Module 1", just recorded the macro is here, feel useless can be deleted, in Module 1, we write the following code (note see picture), can point English should all be able to read. So our macros are built, and any future Excel can be used.
SUB macro 1 Plot area and axis settings ()
Dim halfheight, Halfwidth, offsettop, Offsetleft, chartheight as Double
ActiveChart.ChartArea.Width = 455
ActiveChart.ChartArea.Height = 348
Chartheight = ActiveChart.ChartArea.Height
Selection.insideleft = 45
Selection.insidetop = 10
Selection.insidewidth = 400
Selection.insideheight = 300
Offsetleft = Selection.insideleft
offsettop = Selection.insidetop
Halfwidth = selection.insidewidth 2
Halfheight = selection.insideheight 2
Activechart.axes (xlvalue). Axistitle.select
Selection.left = 0
Selection.top = ((Halfheight + offsettop)-(selection.height 2))
Activechart.axes (xlcategory). Axistitle.select
Selection.left = ((Halfwidth + offsetleft)-(selection.width 2))
Selection.top = chartheight-selection.height-3