How does Excel set the size of the axis title to the alignment area?

Source: Internet
Author: User

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.Select

ActiveChart.ChartArea.Width = 455

ActiveChart.ChartArea.Height = 348

Chartheight = ActiveChart.ChartArea.Height

ActiveChart.PlotArea.Select

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

End Sub

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.