listbox double click which item

I want to know which item in a listbox was double clicked on.
This works but doesn't seem like i should have to do it this way

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim index As Integer

With ListBox1
    For index = 0 To .ListCount - 1
          If .Selected(index) Then
          MsgBox index
          End If
    Next
End With

End Sub

thanks for any tips
mark



0
nospam2621 (61)
1/1/2011 8:55:20 PM
excel 39879 articles. 2 followers. Follow

4 Replies
988 Views

Similar Articles

[PageSpeed] 51

What you are looking for is the ListIndex...

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim Ndex As Long
Ndex = ListBox1.ListIndex
       MsgBox Ndex
End Sub

Also, don't use index as a variable, Excel already uses it.
'---
Jim Cone
Portland, Oregon USA
http://www.contextures.com/excel-sort-addin.html
(30 different ways to sort in excel)



"mp" <nospam@Thanks.com>
wrote in message
news:ifo4bo$ls9$1@news.eternal-september.org...
>I want to know which item in a listbox was double clicked on.
> This works but doesn't seem like i should have to do it this way
>
> Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
> Dim index As Integer
>
> With ListBox1
>    For index = 0 To .ListCount - 1
>          If .Selected(index) Then
>          MsgBox index
>          End If
>    Next
> End With
>
> End Sub
>
> thanks for any tips
> mark 


0
1/1/2011 9:57:53 PM
Thanks

"Jim Cone" <james.coneXXX@comcast.netXXX> wrote in message 
news:ifo81a$ihk$1@speranza.aioe.org...
> What you are looking for is the ListIndex...
>
> Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
> Dim Ndex As Long
> Ndex = ListBox1.ListIndex
>       MsgBox Ndex
> End Sub
>
> Also, don't use index as a variable, Excel already uses it.
> '---
> Jim Cone
> Portland, Oregon USA
> http://www.contextures.com/excel-sort-addin.html
> (30 different ways to sort in excel)
>
>
>
> "mp" <nospam@Thanks.com>
> wrote in message
> news:ifo4bo$ls9$1@news.eternal-september.org...
>>I want to know which item in a listbox was double clicked on.
>> This works but doesn't seem like i should have to do it this way
>>
>> Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
>> Dim index As Integer
>>
>> With ListBox1
>>    For index = 0 To .ListCount - 1
>>          If .Selected(index) Then
>>          MsgBox index
>>          End If
>>    Next
>> End With
>>
>> End Sub
>>
>> thanks for any tips
>> mark
>
> 


0
nospam2621 (61)
1/1/2011 10:01:43 PM
On Sat, 1 Jan 2011 14:55:20 -0600, "mp" <nospam@Thanks.com> wrote:

>I want to know which item in a listbox was double clicked on.
>This works but doesn't seem like i should have to do it this way
>
>Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
>Dim index As Integer
>
>With ListBox1
>    For index = 0 To .ListCount - 1
>          If .Selected(index) Then
>          MsgBox index
>          End If
>    Next
>End With
>
>End Sub
>
>thanks for any tips
>mark
>
>

  Listboxes are SINGLE click to SELECT.  Unles you put up a hard picker
menu and assign hyperlinks or the like to each cell.  Even then, it is
SINGLE click.
0
1/2/2011 2:47:22 AM
"CellShocked" <cellshocked@thecellvalueattheendofthespreadsheet.org> wrote 
in message news:hlpvh6ldmrpi2m0fjpuhpt1au084k5kted@4ax.com...
> On Sat, 1 Jan 2011 14:55:20 -0600, "mp" <nospam@Thanks.com> wrote:
>
>>I want to know which item in a listbox was double clicked on.
>>This works but doesn't seem like i should have to do it this way
>>
>>Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
>>Dim index As Integer
>>
>>With ListBox1
>>    For index = 0 To .ListCount - 1
>>          If .Selected(index) Then
>>          MsgBox index
>>          End If
>>    Next
>>End With
>>
>>End Sub
>>
>>thanks for any tips
>>mark
>>
>>
>
>  Listboxes are SINGLE click to SELECT.  Unles you put up a hard picker
> menu and assign hyperlinks or the like to each cell.  Even then, it is
> SINGLE click.

Thanks for your response.  I'm not sure what your point is though.
I know I can select an item with a single click.  I was just looking for
how to get at the item on which the user double clicks
(which also selects that item - as well as raising the dblclick event)
as Jim pointed out it was ListIndex i was forgetting.
Thanks
Mark
ps...cute nyme :-) 


0
nospam2621 (61)
1/2/2011 2:08:27 PM
Reply:

Similar Artilces:

Size doubles with each save
I have 2 files that include over a 1,000 links and formulas. Every time we save the file, the size doubles. It doesn't matter if any changes are made or not. The only way I've found that will bring it back to a normal size, is to Select All Pages, Move to a new book, and save as the original name. Is there a way to find the problem within the file? What might be causing this? Hi you may also check: http://www.contextures.com/xlfaqApp.html#Unused -- Regards Frank Kabel Frankfurt, Germany "Hargrove" <anonymous@discussions.microsoft.com> schrieb im Newsbeitrag news...

New items with purchase order integration
I'm running a daily integration to bring purchase orders into GP using Integration Manager. The source is a text file. It works very well. The problem I have is with new items. When there is an item in the source file that does not exist in Great Plains, I would like the integration to fail or skip the line item. Currently, it brings the item into the Purchase Order as a non inventory item. The document will show the item number and the cost but no item description. Where can I change the behavior for this? Unfortunately, with the users that put non-inventory items on POs Wh...

How to Clear or Reconcile without right-click
How does one Clear or Reconcile the currently selected transactcion without going through the tedium of right- clicking and selecting Mark As -> Cleared (or Reconciled)? Thanks CTRL-SHIFT-M "MoneyUser" <anonymous@discussions.microsoft.com> wrote in message news:1a72401c41db7$b7003000$a101280a@phx.gbl... > How does one Clear or Reconcile the currently selected > transactcion without going through the tedium of right- > clicking and selecting Mark As -> Cleared (or Reconciled)? > > Thanks In microsoft.public.money, MoneyUser wrote: >How does one Cl...

OnEvent Click and Tab Controls
Good Day All.. I have an issue that I had posted previously but it did not get resolved. It may partially be my fault for not explaining my need/question correctly. I have a form. The form contains a subform. & a tab control. The subform has 3 fields listed for the user: ShipTo, BillTo & Account Name The tab control has 3 tabs. The first tab is where I am struggling right now. I want the user to select ('click') on the "account" in the subform (data sheet) at the top. Once they click the "account" the fields on the tab control will then fill wit...

Purge deleted items from shared mailbox
How can I purge the folder "deleted items" from a shared mailbox? The RM menu item is greyed out. Environment: Outlook 2003/Exchange 2003. What permission do you have on the deleted folder? can you delete them if you open the folder and select all, Del? -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook 2007: http://www.slipstick.com/outlook/ol2007/ Outlook Tips by email: dailytips-subscribe-request@lists.outlooktips.net Outlook Tips: http://www.outlook-tips.net/ Outlook &...

eConnect PM Schema distribution item
Whenever I use eConnect PM distribution on my invoices, I see that the two default distrbution account are always present ; namely Pay on the credit side Purchase on the debit side This is despite the fact I'm explicitly entering in the distribution item of the Schema my own debiting and crediting accounts. so the result is I can see my distributing account along with these two. Kindly advice on how I can ensure via eConnect that the Purchases Invoices distribution list I can only see the distribution accounts I specify in the eConnect XML ...

Not saving records till "save" command button clicked
If you are in a form and adding information, then close out or go to a new for it just saves the record as long as all applicable fields are filled out. Is there a way to only have a record save if a command button is clicked? -- Message posted via http://www.accessmonster.com If you simply hide the form instead of closing it, I think that will prevent the save. Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia "szag via AccessMonster.com" <u2885@uwe> wrote in message news:a75249f4b37bb@uwe... > If you are in a form and adding informat...

Double Click on file and mouse not working
Good afternoon, thanks for taking time to look at my problem. I am trying to open a word document by double clicking on the file name in "my documents". Word opens, but not the document. If you go into File and Open, you can open the document, but the mouse cursor will not go anywhere in the document. I have tried to open Word in safe mode, blasted the normal.dot, copied a normal.dot from another computer, heck I tried disassociating doc from Word. Nothing worked. I even installed Windows Live so I could uninstall it. I'm hoping someone has fixed this problem. ...

Obsolete / inactive items available to sales / inventory processin
Hi all, Does anyone know of a way to disallow obsolete/inactive items from being available for selection on sales orders? Thanks, -- Jim Bourque Two steps: first, in Setup->Sales->Sales Order Processing->Options, uncheck the option to allow sale of discontinued items. Second, mark those items Discontinued in the Item Card. -- Richard L. Whaley Author / Consultant / MVP Documentation for Software Users For help learning and better using Dynamics GP,... check out our books at http://www.AccoladePublications.com "Jim B" wrote: > Hi all, > > Does anyo...

Exchange 2007 Resource Mailboxes
Hi, I have setup Exchange 2007 Resource Mailboxes as I have a number of meeting rooms that all users should be able to book. I have since found that if user a) books a meeting and user b) attempts to delete it - he/she can. I don't seem to be able to prevent them, and would appreciate some help. Regards Nick ...

Verzonden berichten namens wil ik niet in mijn eigen 'Send Items'
Ik heb een persoonlijke en een groepsmailbox in mijn outlook(2000). Als ik nu een bericht verzend namens de groepsmailbox komt dit bericht in mijn persoonlijke "Send Items' terecht. Je raad het al, ik wil graag dat dit in de "Send Items" van de groepsmailbox komt. Heeft iemand enig idee hoe??? W2000 Outlook 2000 Exchange 5.5 Bedankt, Peter Hoi Peter, Er wordt hier voornamelijk Engels gesproken om een zo breed mogelijk publiek aan te spreken. Voor jou probleem is niet direct een oplossing. Je kan wel een Wizard Regel zetten die een kopie in een andere map plaatst bij...

I need the items to have grades
In any business, there are items of different quality, different origin, different level of concentration etc. For example, Tea powder of 3 qualities: High, Medium, low or Tea made in different countries: India, Malasia, China. In the above cases, the item code has to be same because it is basically the same item, but there should be a way to identify them separately. The best way I have seen, to manage this requirement is to have a 'Grade' Column with the Item code. There should be a Grade Master in the Cards Menu of Inventory Module, where the user can create the Grade Type...

Messages not saved in Sent Items Folder
Outlook 2003. Some messages are not being saved to the Sent Items Folder even though it is checked in the options. Does not matter whether is a reply, forward or a new email. It is seemingly random with most messages being saved correctly to the Sent Items Folder. Any Ideas? Thanks, Hugo I have a similar problem, along the lines of the below: When i type email and attempt to send when not connected (due to temporary connectivity issues and when unable to connect), the mail is saved in Outbox. When next connected, the mail is sent *but* the mail is not saved in sent items folder. Sending wh...

Home Page Content Item: Important Dates (repost)
I asked this question 3 days ago and have received no replies so I'm repeating it. Perhaps the subject name I used: "Important Dates" was too short or sounded like spam. In any case my experience on this board is that even if no one has a solution, someone usually responds saying that he can't reproduce the problem, or that it doesn't work for him either, or that the poster misunderstands what this function is supposed to do. Not having received any response at all, I beg your indulgence with this repost: ***** Money 2006. No Passport. XP Home SP2. P4 3.0 GHz. 1G...

2003: Copy R-Click Option Missing!
In outlook 2003 when i right-click on an email message, only the move command/option is there (amongst others), but the copy command is missing? the only way I can copy is to drag the message to a folder with the right mouse button depressed and then the copy option shows up. Why is the copy option missing when I right click on an email message? thank you ...

Can you keep flagged items from being autoarchived?
I would like to be able to let my autoarchive run but for it not to take flagged items to the archive. I keep having to pull them back into the current mail file. Is there something I can set to accomplish this? Hit Alt-Enter while you've got one of these items highlighted then set the option to not AutoArchive the item "dstuart101" <dstuart101@discussions.microsoft.com> wrote in message news:272808E3-27B8-4E34-9A85-4070E91C5FEB@microsoft.com... >I would like to be able to let my autoarchive run but for it not to take > flagged items to the archive. I keep ha...

Report names in listbox
I recently upgraded to Access 2007 and am having some trouble with the changes. I have a form with a listbox in which I would like to display the names of all the reports in the database. I've tried using the following as the rowsource for the listbox, but in form view nothing is displayed. Does anyone know how to do this? TIA, Ken Warthen kenwarthen@gmail.com "SELECT MSysObjects.Name FROM MSysObjects WHERE (((Left([Name],1))<"~") AND ((MSysObjects.Type)=-32764)) ORDER BY MSysObjects.Name;" I think you made a slight typo. Try (((Left([Name],1))<>&quo...

Suppliers with Top Items List
Can anyone let me know how to show suppliers on Top Item List? I badly need this. I tried my way but not successful. -- Many Thanks Install the RMS Toolkit trial download you requested and check off Custom Reports/Templates during installation. Now run Manager, Reports, Custom, Top Items Report. This report includes Suppliers, Dept, Category, and Sub-Descriptions as columns and filter options. There are over 100 free reports and templates included with our RMS Toolkit trial. Visit: www.digitalretailer.com/trial Greg Digital Retail Solutions www.digitalretailer.com/RMSaddins (v1.x and ...

Menu in Word behaving oddly; items (like the entire contents of the Tools menu) disappearing...
Hey, I'd be oh-so-grateful if anyone has any idea how I could address this problem. I'm quite mystified. I'm running MS Word for X on my Mac (OS 10.4.3), and lately some odd things have begun happening. At first I was just working around them, but I've decided live my computer life too much that way (ignoring problems and hoping they go away), so thought I should look into this before it gets out of control. Items have been disappearing from the Word menu bar. That is, for instance, after I had used the "Symbols" option under the "Insert" menu one day, it di...

Can't open this item. The end date you entered occurs before the start date.
Hi, Everytime I open Outlook 2000 I get a calender pop-up. When I Dismiss it I get a message such as the above and the next time I open Outlook it appears again. I can't see it in the Calender unless I change the view to "By category". I can't delete it or change the date in this view. I just keep getting the above message (see subject line). I tried /cleanreminders and the MS article about Daylight savings but neither work. How do I get rid of this message? I do have a Pocket PC and probably the error occured during a Sync (i have different time zones). ...

Tab sequence on Item Maintenance screen
When creating new items on the Item Maintenance screen and tabbing through the fields. The 3rd tab takes you to the Generic Description field, which users may then enter. The next tab takes you to the Class ID field, if you select a Class ID for the item and update the item with information from the class the Generic Description you entered is over-written. While I agree with this functionality, the suggestion is that the tab sequence on the screen should be changed so that when tabbing through the fields you are prompted to select the Class ID first so the Generic Description (and a...

Linking items GREATER THAN O on another worksheet in the same Work
I have a workbook that has about four worksheets … I want to create a list of items that will automatically be included on worksheet tab 4 from Worksheet tab 1 if the quantity for the item listed on the first worksheet has been changed from 0 to any other number (i.e. 1 or 10 etc). I have a list of equipment with pricing on worksheet tab 1 and the list is long. Many of the items will have quantities of zero and will not increase as they will not be selected for the project being created. We have additional columns for cost, extended cost, labor hours etc. If the quantity changes for a...

Auto Empty Deleted Items on Exit OR after X days or X Items accumulated?
In Outlook 2003 is there a way to Auto Empty the Deleted Items Folder, either on Exit OR after X days since deletion or when X number of Items accumulated? -- "J. J." Go to "Tools" : "Options" : "Other" First option is "Empty Deleted Items folder upon exiting" You can set it to delete after x number of days for certain e-mail account types. Go to: "Tools" : "E-Mail Accounts" : Select, "View or change e-mail accounts" Select account to chnage and click "Change..." : Click "More Settings" Se...

sum items in a table based on description
I am interested in summing items is a table based on their description. Is there a formula that will add items together from column based on the contents in another cell reference in the same row? I know a pivot table will do this with some restrictions in the table design. You can use sumif if there is onbly one condition Assume you want to sum values in column C where column B is "x" =SUMIF(B2:B500,"x",C2:C500) Regards, Peo Sjoblom "Hrider" <hrider@yahoo.com> wrote in message news:ejggYE$MFHA.3328@TK2MSFTNGP14.phx.gbl... >I am interested ...

Permission on Sent Items
Hi Does anyone know how to set reviewer permissions on the sent items folder only, when i try and set it and go to open other users folder it doesnt display sent items. This is between two users over an exchange network. Thanks How are you trying to open the folder and what exactly happens when you try? -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook 2007: http://www.slipstick.com/outlook/ol2007/ Outlook Tips by email: dailytips-subscribe-request@lists.outlooktips.net Outlo...