excel vba

nevilled

New Member
Joined
Nov 25, 2016
Messages
2
Dear sir
I have made a list box in excel vba with 3 columns with data and have three Text boxes.
I want when I scrolling in the list box I want the record of the listbox on which the cursor is to be displayed in the text boxes.
Eg in the first row of list box the data in first column to come in first text box , the data of 2nd column should come 2nd text box and 3rd column in 3rd text box.
the records in the text boxes should keep on changing as I move the cursor up and down in the listbox.
Thanks in advance.
Neville
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
So you will need to modify this and you must click on a line but is what you are looking for


Code:
Private Sub ListBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
 Dim ListIndexLong As Long
 ListIndexLong = Me.ListBox1.ListIndex
 If ListIndexLong >= 0 Then
  Me.TextBox1 = Me.ListBox1.Column(0, ListIndexLong)
  Me.TextBox2 = Me.ListBox1.Column(1, ListIndexLong)
  Me.TextBox3 = Me.ListBox1.Column(2, ListIndexLong)
 Else
  Me.TextBox1 = ""
  Me.TextBox2 = ""
  Me.TextBox3 = ""
 End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,240
Messages
6,054,319
Members
444,717
Latest member
melindanegron

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top