小福利,巧用excel的vba语言制作20×20乘法口诀表
如题,我们可以利用excel的vba语言,来制作简单的乘法口诀表
GO按钮代码
Private Sub GO_Click()
Dim i As Integer
Dim j As Integer
For i = 1 To 20
For j = 1 To i
Cells(i, j).Value = i & " × " & j & " = " & i * j
'Cells(j, i).Value = j & " * " & i & " = " & i * j
Next j
Next i
End Sub
DEL按钮代码
Private Sub CommandButton2_Click()
Dim r1 as Range
Set r1 = Range(Cells(1, 1), Cells(99, 99))
r1.Value = ""
End Sub
这样解决了直接用Excel公式生成打印版乘法口诀表,函数编程,天下无敌。