SAMLL 發問時間： 電腦與網際網路程式設計 · 1 0 年前

# VB 九九乘法

2X1=2 3X1=3 4X1=4

2X2=4 3X2=6 4X2=8

. . .

. . .

2X10=10 3X10=30 4X10=40

5X1=5 6X1=6 7X1=7

. . .

. . .

8X1=8 9X1=9

. .

. .

Sub HW( )

Dim i As Integer, j As Integer, z As Integer, a As Integer, b As Integer, c As Integer, d As Integer

a=1

c=0

b=0

d=0

For z=1 to 3

For i=2 to 4

For j=1 to 10

b=j+d

i=i+c

If i > 9 Then GoTo 10

Cells(b, a) = i

Cells(b, a+1) = "X"

Cells(b, a+2) = j

Cells(b, a+3) = "="

Cells(b, a+4) = i * j

Next j

a=a+6

Next i

d=d+11

c=c+3

Next z

10 End Sub

### 2 個解答

• pop
Lv 7
1 0 年前
最佳解答

阿國仔大大好:

版主好:

直接 copy 下列_就可以達到你的要求.

Private Sub CommandButton2_Click()

Range("A1:C27").ClearContents

For i = 2 To 9 Step 3

m2 = 0

For J = 1 To 9

For K = i To 9

m2 = m1 * 9 ＋ J

If m1 = 0 Then

If K <= 4 Then Cells(m2, K - 1) = K & "x" & J & "=" & J * K

ElseIf m1 = 1 Then

If K - 4 > 0 And K - 4 < 4 Then Cells(m2, K - 4) = K & "x" & J & "=" & J * K

Else

Cells(m2, K - 7) = K & "x" & J & "=" & J * K

End If

Next K

Next J

m1 = m1 ＋ 1

Next i

End Sub

以上 ＋ 是全型_ 請改回半型

希望有幫上忙

• 1 0 年前

參考如下之迴圈：

For i = 2 To 8 Step 3

For k = 1 To 10

For j = i To i + 2

Print j & " * " & k & " = " & j * k & Space(4);

Next

Print

Next

Next

輸出至Excel 儲存格，改成你的格式即可。