Solved excel listbox not reacting on my click all the time

April 23, 2017 at 02:25:27
Specs: Windows 10
hello :)
i have an excel file where on the first page i can type part of a first or last name of a person,
and the listbox, place right under it, is filled with the names filtered from the long list that is
put on sheet 2.
but: sometimes it doesnt answer my click:
- or i type a name and it jumps to that person without showing the listbox list with one or more
names to choose ;
- or i get the list but when i click on the FIRST name nothing happens...
where could i have done something wrong ?
pete, belgium

See More: excel listbox not reacting on my click all the time

Report •

✔ Best Answer
April 30, 2017 at 03:08:58
problem solved thanks to derbydad03 !

change
Private Sub ListBox1_Click()

with
Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

and each time you get a list, or one name, and each time you can click on your choice !
thank you derbydad03 !!!

message edited by LittlePete



#1
April 23, 2017 at 06:26:44
I don't think you've supplied enough information for us to be of much assistance.

Without knowing how the list box is created, where the data comes from, etc. there isn't much help we can offer.

Many times we attempt to recreate the situation and see if we can get it to fail. We can't do that without more detail.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

message edited by DerbyDad03


Report •

#2
April 23, 2017 at 06:56:47
ok :) i understand let me explain in detail:
sheet 1 called seniorama has cell j31 where i can type any part of a name, for ex.: "pete" should give pete, peter, karpeta, ...
the listbox is an active x element placed over the cells right under j31, so that it can show 5 lines, and a vertical bar at the right side to move down.
on sheet 2 called lijst the complete list of names in column d (d2 and down) ; the value type in j31 is copied to cell a2 on sheet 2; a filter (formulae) puts the result in column B (b2 and down).
event triggers check if anything is typed in j31; then in a2 and at last if anything is in column B.
the short list of names is put in the listbox (=> listfillrange = named range filterlijstres).

these are the parts of code I use:

Private Sub ListBox1_Click()
zoekpersoon = UCase(ListBox1.Value)
ActiveWindow.ScrollRow = Range("personen").Row
Range("invulnaam").Value = zoekpersoon
fotokiezen
End Sub

also:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("vrwnaam")) Is Nothing Then 
'  1. => naam kopieren naar filterlijst
    Sheets("lijst").Range("filterlijstkeuze").Value = _
      Sheets("seniorama").Range("vrwnaam").Value
End If
If Not Intersect(Target, Range("dienstnaam")) Is Nothing Then 
' 1. => naam kopieren naar filterlijst
    Sheets("diensten").Range("dienstenlijstkeuze").Value = _
       Sheets("seniorama").Range("dienstnaam").Value
End If
End Sub

the last part works perfectly: the clicked name is copied to the named range invulnaam (fill in name) and all data are shown from that person.

only: when i type a string many times the listbox is not shown but directly going to the 70 rows where all data are shown... if then i return to the first 70 rows it does show the listbox and the filtered list, and then i can always click on any name in that list ; but almost never on the FIRST name...

if you'd like my file, mail me at xxx@xxx.x
thank you for your time :)
pete, belgium

edited by moderator: email address removed


Report •

#3
April 23, 2017 at 09:01:53
I have sent you an email requesting the file.

As noted in the email, please remove any personal or confidential information that the file might contain before sending it to me. You have no clue who I am or what evil things I might do with the data.

In addition I have edited your post to remove your plain text email address. It's not that we really care if you suddenly receive a lot of spam, it's that we don't want to become known as a forum where email addresses can be harvested. Once the bad guys start hanging around, it's very hard to get rid of them.

In the future, instead of putting your email address in a post, send a Private Message by clicking on member's name and then clicking on their name again on the "Stats" page.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

Related Solutions

#4
April 24, 2017 at 07:39:45
Just an update:

I was unable to work on your project last night. Sometimes life happens. ;-) I'll do my best to work on it tonight, US-EST.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#5
April 30, 2017 at 03:08:58
✔ Best Answer
problem solved thanks to derbydad03 !

change
Private Sub ListBox1_Click()

with
Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

and each time you get a list, or one name, and each time you can click on your choice !
thank you derbydad03 !!!

message edited by LittlePete


Report •

Ask Question