Hello there,

I am trying to create a do while loop for the below code on the user form. Not able to execute. In below code Textbox1 has date (i.e FROM Date) this works fine.
Now I have added another text box TextBox3 which will have (TO date). I want the do all the steps in the below code for each date i.e FROM date to TO date... eg if FROM date (TextBox1) is 07/01/2015 and To date (TextBox3) is 07/10/2015, i want the data to be copied from form to Excel table in 10 rows (each row for a single date).
Any thoughts on how loop can be applied for this.

Private Sub CommandButton1_Click()
Dim lRow As Long
Dim lPart As Long
Dim ws As Worksheet
Dim x As Range, ff As String, Tdate
Dim i As Integer
Set ws = Worksheets("ViewData")

'find  first empty row in database
lRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
    SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
    
lPart = Me.ComboBox1.ListIndex

'copy the data to the database
With ws
  .Cells(lRow, 4).Value = Me.TextBox1.Value
  .Cells(lRow, 5).Value = Me.ComboBox1.Value
  .Cells(lRow, 6).Value = Me.ComboBox1.List(lPart, 1)
  .Cells(lRow, 6).Value = Me.Label2
  .Cells(lRow, 7).Value = Me.Label6
  .Cells(lRow, 8).Value = Me.ComboBox3.Value
  .Cells(lRow, 9).Value = Me.ComboBox3.List(lPart, 1)
  .Cells(lRow, 9).Value = Me.ComboBox2.Value
  .Cells(lRow, 10).Value = Me.TextBox2.Value
End With
End Sub
Thanks!
H N S