+ Reply to Thread
Results 1 to 6 of 6

Run 1 macro when any item from listbox is selected

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Run 1 macro when any item from listbox is selected

    Hi everybody.
    I have 1 macro that i would like to be activated as soon as i select any item from a form control listbox (doesn't matter which item).
    Is this possible?
    Please note that i am not using an active X control but rather a form control.

    Thank you.

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,414

    Re: Run 1 macro when any item from listbox is selected

    Hi,
    if you right click on the control, you can assign a macro... no ?
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Run 1 macro when any item from listbox is selected

    I know that.
    Happens to be i just figured out my problem, the macro that was supposed to run automatically wasn't named right.

    (do i deserve a rep for this lol)

  4. #4
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Run 1 macro when any item from listbox is selected

    Hi.
    Try
    considering that the listbox is linked in cell E5
    Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.Address = "$E$5" Then
    
    'Your Code Here
    
    End If
    
    End Sub
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  5. #5
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Run 1 macro when any item from listbox is selected

    Quote Originally Posted by marreco View Post
    Hi.
    Try
    considering that the listbox is linked in cell E5
    Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.Address = "$E$5" Then
    
    'Your Code Here
    
    End If
    
    End Sub
    It worked like a charm, thanks!

  6. #6
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Run 1 macro when any item from listbox is selected

    Hi.
    click on the star.
    then mark your post as solved, please!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro to run when item is selected from listbox
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-30-2014, 09:58 PM
  2. Remove selected item from listbox
    By ChrisMattock in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-28-2014, 08:36 AM
  3. how do I return a HIGHLIGHTED (not selected) item from a ListBox?
    By michaeljoeyeager in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2012, 08:27 AM
  4. Change status of more than one item selected in Listbox
    By CobraLAD in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-29-2012, 05:09 AM
  5. Need selected item from listbox after double click
    By peterfarge@hotmail.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2006, 11:20 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1