T
TK
Hi:
The following sub is used to populate a listBox of course.
The problem is that after it is activated and an item is picked
if an arrow key is pressed each item is displayed in the ActiveCell
as the pointer moves up or down the list.
How can I avoid that?
Private Sub ListBox1_Click()
Dim SourceRange As Range
Dim Val1 As String
Dim Val2 As String
' RowSource created with Insert - Name - Define
' Range Name is Data so set ListBox1's Properties RowSource = Data
Set SourceRange = Range(ListBox1.RowSource)
Val1 = ListBox1.Value
Val2 = SourceRange.Offset(ListBox1.ListIndex, 1).Resize(1, 1).Value
ActiveCell.Value = Val1
ActiveCell.Offset(0, 3) = Val2
ActiveCell.Offset(1, 0).Activate
End Sub
Thanks
TK
The following sub is used to populate a listBox of course.
The problem is that after it is activated and an item is picked
if an arrow key is pressed each item is displayed in the ActiveCell
as the pointer moves up or down the list.
How can I avoid that?
Private Sub ListBox1_Click()
Dim SourceRange As Range
Dim Val1 As String
Dim Val2 As String
' RowSource created with Insert - Name - Define
' Range Name is Data so set ListBox1's Properties RowSource = Data
Set SourceRange = Range(ListBox1.RowSource)
Val1 = ListBox1.Value
Val2 = SourceRange.Offset(ListBox1.ListIndex, 1).Resize(1, 1).Value
ActiveCell.Value = Val1
ActiveCell.Offset(0, 3) = Val2
ActiveCell.Offset(1, 0).Activate
End Sub
Thanks
TK