VB Code:
Public Sub CreateArray(totalcount As Integer, rowmax As Integer)
Dim cmdBtn As Control
Dim ctrRow As Long
Dim ctrCol As Long
Dim InitialLeft As Long
Dim InitialTop As Long
Dim OffsetV As Long
Dim OffsetH As Long
ctrRow = 0
ctrCol = 0
InitialLeft = 1920
InitialTop = 3000
OffsetV = 695
OffsetH = 2475
For i = 1 To totalcount
Load cmdDesktop(i)
cmdDesktop(i).Height = 450
cmdDesktop(i).Width = 2175
cmdDesktop(i).Visible = True
cmdDesktop(i).Top = InitialTop + (OffsetV * ctrRow)
cmdDesktop(it).Left = InitialLeft + (OffsetH * ctrCol)
If ctrRow < rowmax Then
ctrRow = ctrRow + 1
Else
ctrRow = 0
ctrCol = ctrCol + 1
End If
Next
End Sub