Sub multiPlus()
'//九九乘法表
'//by Sdx孙大侠//公众号【Excel小火箭】
Dim i As Integer, j As Integer
Dim rng As Range, c As Range
Dim sht As Worksheet
Application.ScreenUpdating = False
Set sht = ActiveSheet
With sht
.Cells.Range("A:I").Clear
For i = 1 To 9
For j = 1 To i
.Cells(i, j) = " " & CStr(i) & "×" & CStr(j) & "=" & i * j & " "
.Cells(i + 1, j) = CStr(j)
Next
Next
'//格式调整
With .Cells
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Columns.AutoFit
End With
Set rng = sht.Range("A1:I10") '//加边框
For Each c In rng
If Len(c.Value) > 0 Then c.Borders.LineStyle = 1
Next
Set rng = Nothing
.Range("E1") = "九九乘法口诀表"
.Range("E37") = "闯关成功记得在格子里画爱心打卡哦"
.Range("A10:I35").Borders.LineStyle = 1
End With
Set sht = Nothing
Application.ScreenUpdating = True
End Sub
△ 回复“小火箭”,获取源代码
希望本期文章对你有所启发,VBA源代码已同步上传,欢迎下载。