+ Reply to Thread
Results 1 to 8 of 8

Code no longer works as expected

  1. #1
    Registered User
    Join Date
    07-03-2015
    Location
    brisbane
    MS-Off Ver
    2003
    Posts
    28

    Unhappy Code no longer works as expected

    I got this code from AlphaFrog which worked great, however, now it doesn't and I am not sure why.
    I have done a lot to the project since implementing this code and am not sure if this is the cause?

    The code allows the user to select various columns (not nessariliy in sequence) in the active spreadsheet from Listbox2 and export the columns to a new workbook.

    What happens now is that irrelevant of what column heading is selected in the listbox, the code only seems to look at how many items are in the list and returns the number of columns in sequence from 1 to i. I think there is something amiss with the Union?

    Please Login or Register  to view this content.
    list box code
    Please Login or Register  to view this content.
    Last edited by vbapadawan; 07-20-2015 at 06:18 PM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Code no longer works as expected

    Quote Originally Posted by vbapadawan View Post
    which worked great, however, now it doesn't
    Too vague.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    07-03-2015
    Location
    brisbane
    MS-Off Ver
    2003
    Posts
    28

    Re: Code no longer works as expected

    Quote Originally Posted by AlphaFrog View Post
    Too vague.
    Sorry AlphaFrog, I added some detail, The problem I am having is that it doesn't matter what I select in Listbox2, it seems to only count how many entries have been moved form Listbox1 to Listbox2, selects the number of columns in the count from left to right and exports that I'm not sure why it no longer works; I didn't change the activesheet except I added some columns. I cannot include data example as it is sensitive.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Code no longer works as expected

    Can you provide an example workbook?

  5. #5
    Registered User
    Join Date
    07-03-2015
    Location
    brisbane
    MS-Off Ver
    2003
    Posts
    28

    Re: Code no longer works as expected

    Quote Originally Posted by AlphaFrog View Post
    Can you provide an example workbook?
    i have attached an example...
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: Code no longer works as expected

    I modified your code, by adding a nested for loop that checks the list items against the column headers, and then add the matched column header range into the MyRange union.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-03-2015
    Location
    brisbane
    MS-Off Ver
    2003
    Posts
    28

    Re: Code no longer works as expected

    Thats Perfect, job Done. Thank you Poizhan


    Quote Originally Posted by Poizhan View Post
    I modified your code, by adding a nested for loop that checks the list items against the column headers, and then add the matched column header range into the MyRange union.

    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373
    Youre welcome

    Quote Originally Posted by vbapadawan View Post
    Thats Perfect, job Done. Thank you Poizhan

+ 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. Help with code that no longer works pls
    By Mulix79 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2015, 08:48 AM
  2. VBA Code No Longer Works
    By cindywylie in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-18-2015, 02:20 PM
  3. Moving from Office 2003 to Office 2013 - code no longer works
    By GeorgeC47 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-27-2014, 11:20 AM
  4. [SOLVED] Code no longer works after upgrading to WIN 7
    By jh51745 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2014, 02:12 PM
  5. Migration from Excel 2003 to Excel 2007 and chart naming code no longer works...
    By SteHawk85 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-05-2012, 10:14 AM
  6. Can no longer get LOOKUP to work as expected! (2007)
    By JayUSA in forum Excel General
    Replies: 6
    Last Post: 06-17-2009, 02:25 PM
  7. [SOLVED] folderexists code no longer works after moving to excel 2003
    By sdharris - ExcelForums.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-02-2005, 05:06 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