VBA实例

(1)99乘法表,以及为此表修改格式
Sub test()
 For x = 1 To 10
   For y = 1 To 10
    Cells(x, y).Value = x & "*" & y & "=" & x * y
   Next y
 Next x
End Sub
Sub test2()
Dim cell As Variant
Worksheets(1).Select
For Each cell In Range("a1:j10")
  cell.Font.Size = 18
Next
End Sub

Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
If Button = xlPrimaryButton Then
test
End If
If Button = xlSecondaryButton Then
 test2
 End If
End Sub
【待续】

原文地址:https://www.cnblogs.com/liudong/p/1217211.html