VBA 乘法口诀

Option Explicit

Sub chengfabiao()

Dim i As Integer  '声明变量
Dim j As Integer
    For i = 1 To 9   '循环嵌套
        For j = 1 To i
            Cells(i, j) = j & "x" & i & "=" & i * j
            Cells(i, j).Select
            With Selection ‘单元格居中
                HorizontalAlignment = xlCenter
                VerticalAlignment = xlCenter
                WrapText = False
                Orientation = 0
                AddIndent = False
                IndentLevel = 0
                ShrinkToFit = False
                ReadingOrder = xlContext
                MergeCells = False
            End With
        Next
    Next
    
End Sub

  

猜你喜欢

转载自www.cnblogs.com/queqiaoshui/p/10258920.html
vba