list box

E

enyaw

I have a list of items in a worksheet. The worksheet uses this list via
validation to allow to have a drop down menu in some of the cells. I also
have a userform that uses this list to populate a listbox. When I open the
userform I have coding that allows me to select an item on the worksheet
using the listbox. The problem is when I close the userform and want to use
the worksheet validation cells to select an item excel jumps to the start of
the validation list.

Here is the code for the list box:
Private Sub CommandButton1_Click()
With activeworksheet
ActiveCell.Select
ActiveCell.Offset(0, 5).Select
If ActiveCell = "Yes" Then
ActiveCell.Offset(0, -1).Select
ActiveCell.ClearContents
Else
MsgBox "Cannot Reset"
End If
End With
End Sub

Private Sub CommandButton2_Click()
UserForm1.Hide
End Sub

Private Sub ListBox1_Click()
With activeworksheet
Range("Part")(UserForm1.ListBox1.ListIndex + 1).Select
End With
End Sub

Commandbutton2 closes the form
Commandbutton1 resets some information

Can anyone help?
 

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