Hi
try this macro
Sub create_table()
Dim RowCell As String, ColCell As String, DestCell As String, TableEnd, n As Long, nZ As Long
RowCell = "B2" 'cell with number of rows
ColCell = "B1" 'cell with number of columns
DestCell = "D24" 'first cell of new table
TableEnd = Range(DestCell).Offset(Range(RowCell).Value, Range(ColCell).Value).Address
For n = 1 To Range(ColCell).Value
Range(DestCell).Offset(0, n).Value = n
Next n
For n = 1 To Range(RowCell).Value
Range(DestCell).Offset(n, 0).Value = n
Next n
For nZ = 1 To 4
Range(Range(DestCell).Offset(1, 1).Address, TableEnd).Borders(nZ).LineStyle = xlContinuous
Next nZ
End Sub
Bookmarks