Worksheet and Listbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a listbox and basically what happens is if the user double-clicks the
listbox the listbox value will be copied into the worksheet activecell if the
activecell is in column C. What I do not like is when the cursor is in a
cell in column C and then the user clicks on the listbox the activecell on
the worksheet is not identified with a bold border or anything and the user
cannot really tell which cell they were in until they double-click the
listbox and the listbox value is passed to the ActiveCell.

Question: Is there some way that when you click onto the Listbox that you
can still tell which cell is the activecell on the worksheet.

Thank you for your help.

Steven
 
One crude way of doing it is to put this code in the Selection Change event
of your worksheet and see if it works for you.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Static c As Range
Static ci As Integer
If Not c Is Nothing Then
c.Interior.ColorIndex = ci
End If
ci = Target.Cells(1).Interior.ColorIndex
Target.Cells(1).Interior.ColorIndex = 36
Set c = Target.Cells(1)

End Sub
 
Back
Top