Have the standard excel dbase to jazz up our asset register. All working well, however I cannot for the life of me get the active cell selected from my listbox control.
I have a find button which shows more than one record, however when a line is selected I need it to actively select that row on the worksheet so that I can delete that line if necessary. I know I need to set something as the active row and defined this as c at the start, but when the original find is done, it goes to the first active cell only. I need to be able to select a row from the listbox and have the active cell selected.
Excel 2010, Windows 7
Thanks in advance
Private Sub ListBox1_Click()
If Me.ListBox1.ListIndex = -1 Then 'not selected
MsgBox " No selection made"
ElseIf Me.ListBox1.ListIndex >= 1 Then 'User has selected
r = Me.ListBox1.ListIndex
.puntxt.Value = ListBox1.List(r, 0)
.wkstntxt.Value = ListBox1.List(r, 2)
.dpttxt.Value = ListBox1.List(r, 3)
.unmtxt.Value = ListBox1.List(r, 4)
.proftxt.Value = ListBox1.List(r, 5)
.emailtxt.Value = ListBox1.List(r, 6)
.pwrdtxt.Value = ListBox1.List(r, 7)
.cmbAmend.Enabled = True 'allow amendment or
.cmbDelete.Enabled = True 'allow record deletion
If ListBox1.List(r, 8) = "Yes" Then
.optYes = True
ElseIf ListBox1.List(r, 8) = "No" Then
.optNo = True