Ok, I have this code as an ex.:

Private Sub Command1_Click()
  Dim L As Long, L1
  L = Label1.UBound
  L1 = L + 1
  Load Label1(L1)
  Label1(L1).Move Label1(L).Left + Label1(L).Width
  Label1(L1).Visible = True
End Sub

If I press the button two times, it will make two copies of Label1 in one row (total 3 labels). What lines should be added to this code, if I want the fourth label to be copied on the second row? Then again two copies, and the seventh label on third row and so on?

you can use for loop for this

Dim L1 As Long
Dim i As Integer, iT As Long

'Last Control's Top and Height
iT = Label1(Label1.UBound).Top + Label1(Label1.UBound).Height
For i = 0 To 1
   L1 = Label1.UBound + 1
   Load Label1(L1)
   'First Control's Left property and Total Width
   Label1(L1).Move Label1(0).Left + (Label1(0).Width * i), iT
   Label1(L1).Visible = True
Next

Thank you again selva :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.