【发布时间】:2011-07-20 08:36:00
【问题描述】:
需要在 Excel 中使用 VBA 打印任意数字的表格。即每一行之后的空白行。下面是我写的连续行打印表格,但我不知道如何在交替行中打印结果?
Sub table()
a = InputBox("Enter first no")
ActiveSheet.Cells.Clear
ActiveSheet.Cells(5, 4) = "TABLE OF " & a
For i = 1 To 10
c = a * i
ActiveSheet.Cells(i + 5, 4) = a
ActiveSheet.Cells(i + 5, 5) = "*"
ActiveSheet.Cells(i + 5, 6) = i
ActiveSheet.Cells(i + 5, 7) = "="
ActiveSheet.Cells(i + 5, 8).Value = c
next i
End Sub
【问题讨论】: