Reject Manual Input

S

SMERTZ

I have two questions for a list box. I have the code to put the list box in
thanks to this list. Now I need to do 2 things

1. Make sure typed in data is rejected unless the list box was used
2. Make sure the cursor is always in Column "C" before entering the
contents of the list box.

I seem to remember a way to auto run a macro on workbook open, but can't
find
it in the help files. I know it was something simply like naming the macro
Automatic or something

CODE FOR "OK" Button

Private Sub cmdOK_Click()
Dim strnames As String
Dim x As Integer

For x = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(x) Then
strnames = strnames & ListBox1.List(x) & ", "
End If
Next x

If Not strnames = "" Then
strnames = Left(strnames, Len(strnames) - 1)
End If
ActiveCell.Value = strnames

ListBox1.RowSource = "MyList"

End Sub
 

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