george hart
Board Regular
- Joined
- Dec 4, 2008
- Messages
- 241
Hi again
I need the code to place what's selected in a combobox into the next "blank" cell in column "B". This code works but places the selected item into all cells in column B that are not blank???..confused.
Private Sub OKButton_Click()
Dim x As Variant
For x = 4 To Cells(Rows.Count, "B").End(xlUp).Row
If Range("B" & x).Value <> "" Then Range("B" & x) = ComboBox1.Value
Next x
Unload UserForm1
End Sub
I need the code to place what's selected in a combobox into the next "blank" cell in column "B". This code works but places the selected item into all cells in column B that are not blank???..confused.
Private Sub OKButton_Click()
Dim x As Variant
For x = 4 To Cells(Rows.Count, "B").End(xlUp).Row
If Range("B" & x).Value <> "" Then Range("B" & x) = ComboBox1.Value
Next x
Unload UserForm1
End Sub