Combobox not writing value if next selection is same

G

Guest

Hello

The code I have below works very well to write the value chosen in the combobox to teh appropriate cell in a list. The problem I have is if the value chosen the next time I use the combobox is the same as the previous, nothing will be written. I have tried using an if/then/else to compare the previous cell to the value and using the Range statement below for true and false but it did not work. Can someone please offer some code options

Thank you, Jo

Dim drpdwn As DropDow
Set drpdwn = ActiveSheet.DropDowns(Application.Caller
With drpdw
Range("b1").End(xlDown).Offset(1, 0).Value = .List(.ListIndex
End Wit
End Sub
 
D

Dave Peterson

I think I'd just clear the dropdown and let the user start from scratch:

Dim drpdwn As DropDown
Set drpdwn = ActiveSheet.DropDowns(Application.Caller)
With drpdwn
Range("b1").End(xlDown).Offset(1, 0).Value = .List(.ListIndex)
.listindex = 0
End With
End Sub

Or maybe you could supply another button near the dropdown. Have them use this
to "repeat" the value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top