Build "99 multiplication table" with Excel 2007

Source: Internet
Author: User

For elementary School mathematics children, learn the "99 multiplication table" mantra, is equal to open into the multiplication of the Temple gate. As a parent of you and Excel is more proficient, you can do it yourself to do for them, here we take Excel 2007 as an example to illustrate.

After running Excel 2007, click to switch to the macro option, click "View Macros" in the "Macros" option group to open the Macro dialog box, under "Macro name" Enter a name (such as "multiplication table"), click the "Create" button into the VBA edit state (Figure 1).

Figure 1 Excel Macro Settings

Then clear the code in the right pane and enter the following code:

Sub 九九表()
  Dim i As Byte, j As Byte, msg As String
  For i = 1 To 9 ‘定义相乘的一个数字变量
    msg = msg & Chr(10)
    For j = 1 To I ‘定义另一个数字变量
      msg = msg & WorksheetFunction.Text(j, "[DBNum1][$-804]0") & WorksheetFunction.Text(i, "[DBNum1][$-804]0") & VBA.IIf(i * j > 9, "", "得") _
         & WorksheetFunction.Text(i * j, "[DBNum1][$-804]0") &
‘完成两个数字相乘运行,如相乘的结果小于10的话则在中间加“地”字
Space(3)
    Next
  Next
  MsgBox msg, 64, "九九表" ‘显示在窗口右上角的标题
End Sub

Then press the ALT+Q key combination to close and return to Excel, OK, press the ALT+F8 key combination again open the Macro dialog box, click the "Run" button to see if we are familiar with the "99 multiplication table"? (Figure 2)

Figure 2 The 99 multiplication table in Excel

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.