Sub 汉语乘法口诀()
Dim x%, y%, n%, s$
s = "一二三四五六七八九"
n = 1
Range("A1:H1").Select
ActiveCell.FormulaR1C1 = "汉语乘法口诀表"
With Selection
.Merge
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Font.Size = 48
.Font.ColorIndex = 5
End With
For x = 2 To 10
For y = 1 To n
Cells(x, y).Select
If (x - 1) * y < 10 Then
Cells(x, y).Value = Mid(s, y, 1) & Mid(s, x - 1, 1) & "得" & Mid(s, (x - 1) * y, 1)
Else
If Mid(Format((x - 1) * y, "0"), 2, 1) = "0" Then
Cells(x, y).Value = Mid(s, y, 1) & Mid(s, x - 1, 1) & Mid(s, (x - 1) * y / 10, 1) & "十"
Else
If (x - 1) * y > 10 And (x - 1) * y < 20 Then
Cells(x, y).Value = Mid(s, y, 1) & Mid(s, x - 1, 1) & "十" & Mid(s, Val(Mid(Format((x - 1) * y, "0"), 2, 1)), 1)
Else
Cells(x, y).Value = Mid(s, y, 1) & Mid(s, x - 1, 1) & Mid(s, Val(Mid(Format((x - 1) * y, "0"), 1, 1)), 1) & "十" & Mid(s, Val(Mid(Format((x - 1) * y, "0"), 2, 1)), 1)
End If
End If
End If
With ActiveCell
.Borders.LineStyle = xlDouble
.Borders.Weight = xlThick
.Borders.ColorIndex = 3
.Characters(Start:=1, Length:=1).Font.ColorIndex = 3
.Characters(Start:=2, Length:=1).Font.ColorIndex = 1
.Characters(Start:=3, Length:=1).Font.ColorIndex = 5
.Characters(Start:=4, Length:=1).Font.ColorIndex = 1
.Characters(Start:=5, Length:=2).Font.ColorIndex = 4
End With
Next y
n = n + 1
Next x
Columns("a:i").ColumnWidth = 27
End Sub
本文来源:https://www.wddqw.com/doc/457a969bf61fb7360a4c6529.html
正在阅读:
汉语乘法口诀VBA01-01
一支淡笔抒写人间至味01-01
水果的英语怎么拼写01-01
大班下学期教育随笔《我被孩子表扬了》01-01
人教版小学五年级英语单词01-01
魂飞魄散的造句01-01
商品学概论调研报告01-01
中国民俗文化故事01-01
扑克牌80分(俗称双升)游戏玩法01-01