Printing alternate lines in VBA

You need to print a table of any numbers using VBA in excel. those. empty line after each line. Below I wrote to print the table in consecutive lines, But I do not know how I can print the result in alternative lines?

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
+3
source share
2 answers
Sub table()
a = InputBox("Enter first no")
n As Integer

n=6
ActiveSheet.Cells.Clear
ActiveSheet.Cells(5, 4) = "TABLE OF " & a
For i = 1 To 10
  c = a * i
  ActiveSheet.Cells(n, 4) = a
  ActiveSheet.Cells(n, 5) = "*"
  ActiveSheet.Cells(n, 6) = i
  ActiveSheet.Cells(n, 7) = "="
  ActiveSheet.Cells(n, 8).Value = c
  n = n + 2
next i
End Sub
+2
source

Change the calculation of the line number from

i + 5 

to

(i * 2) + 4
+2
source

All Articles