Good morning all,
I'm trying to get my head round a problem I've got and I'm hoping you guys can help.
I've got a userform that when used will copy the information on it to the first empty row on my spreadsheet, and it works nicely.
I want to add multiple selections to the userform so that when you hit the 'Submit' button it will populate the first row with the first selection, the second row with the second etc until it hits an empty selection and then it will unload.
I tried simply copying the code for the next entries but it just overwrites the previous information instead of moving down to the next row.
Here's what I've got so far:
Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet4")
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
If ComboBox1 = "" Then
Unload Me
Else
With ws
.Cells(iRow, 1).Value = Me.Doy.Value
.Cells(iRow, 3).Value = Me.Cust.Value
.Cells(iRow, 4).Value = Me.ComboBox1.Value
.Cells(iRow, 5).Value = Me.Order1.Value
End With
End If
If ComboBox2 = "" Then
Unload Me
Else
With ws
.Cells(iRow, 1).Value = Me.Doy.Value
.Cells(iRow, 3).Value = Me.Cust.Value
.Cells(iRow, 4).Value = Me.ComboBox2.Value
.Cells(iRow, 5).Value = Me.Order2.Value
End With
End If
End Sub
As you can see, the iRow function should find the next empty row each time, but it isn't.
Any help is gratefully recieved!
Bookmarks