I have an excel vba form with a comboBox and listBox. I'm saving the listbox items to the last empty row in a column. I'm trying to save the comboBox selection using the same last empty row as the listbox and move 1 column left.
Code:
Private Sub CmdUpdate_Click()
Dim ws As Worksheet
Dim x As Long, lRow As Integer
lRow = Sheets("sheet1").Range("B" & Rows.Count).End(xlUp).Row
lRow = lRow + 1
If CboProjectList = "" Then
MsgBox "Select Project Number"
Else
If CboProjectList > "" Then
Worksheets("Sheet1").Range("a2").Value = CboProjectList.Value
Else
End If
If LstBxNwItems.ListIndex = -1 Then
MsgBox "Please Add Deliverables"
Else
For x = 0 To LstBxNwItems.ListCount - 1
Range("b" & lRow + x) = LstBxNwItems.List(x)
Next x
End If
End If
LstBxNwItems.Clear
CboProjectList.Clear
CboProjectList.SetFocus
End Sub
