+ Reply to Thread
Results 1 to 8 of 8

Call macro for the sheets selected in listbox

  1. #1
    Registered User
    Join Date
    09-10-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    61

    Call macro for the sheets selected in listbox

    Please help me
    what is wrong with my code, i can't seem to loop the code for the sheets that I have selected using the listbox.

    please see my codes here and advise what i need to change.

    Please Login or Register  to view this content.
    This is my userform listbox


    Please Login or Register  to view this content.
    This is the button where I want to run the macro for the sheets selected.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,967

    Re: Call macro for the sheets selected in listbox

    solved elsewhere
    Last edited by protonLeah; 10-30-2014 at 10:30 PM.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    09-10-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: Call macro for the sheets selected in listbox

    Thanks protonLeah

    Do I need to use the For i = 0 To ListBox1.ListCount - 1 if in my listbox i'm selecting by the sheetnames?
    Can I just loop the codes for the sheetnames instead of by selecting the sheet?

    I can't seem to get it right, maybe is because in my listbox I'm excluding 3 sheets (Vessels, Location and summary)


    Can you teach me how to just select the sheetnames?

  4. #4
    Registered User
    Join Date
    09-10-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: Call macro for the sheets selected in listbox

    i keep selecting the sheets that i have not selected... is there something broken in my first code for the userform?

    i wanna cry...

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,967

    Re: Call macro for the sheets selected in listbox

    solved elsewhere
    Last edited by protonLeah; 10-30-2014 at 10:30 PM.

  6. #6
    Registered User
    Join Date
    09-10-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: Call macro for the sheets selected in listbox

    still no luck.


    i'm able to populate all the sheetnames in my listbox in the userform.

    Now i need to run a code on each of the sheets selected from the listbox.

    how do i do this?

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,967

    Re: Call macro for the sheets selected in listbox

    solved elsewhere
    Last edited by protonLeah; 10-30-2014 at 10:30 PM.

  8. #8
    Registered User
    Join Date
    09-10-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: Call macro for the sheets selected in listbox

    Thanks protonleah

    yes, i have got it solves in another thread.

    here is the sample file that i have successfully done it.

    just to share to anyone who is going through the same problem.

    Combine Success1.xlsm

+ 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. [SOLVED] Run 1 macro when any item from listbox is selected
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-30-2014, 09:52 PM
  3. Call macro if specific text is within listbox
    By EthanM in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-02-2011, 12:00 AM
  4. Print only selected sheets from listbox
    By stevemcleod in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-09-2010, 03:24 PM
  5. call macro if cell is selected
    By Corey in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-17-2006, 03:45 AM

Tags for this Thread

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