+ Reply to Thread
Results 1 to 13 of 13

VBA to return multiple columns

  1. #1
    Forum Contributor
    Join Date
    05-01-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    822

    VBA to return multiple columns

    Hi,

    My code i have below returns a number of columns in order of each other;

    Please Login or Register  to view this content.
    What i am trying to do is return specific columns of data i.e column A, column M, column AA column CJ

    Any idea how to do this?

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA to return multiple columns

    Hi Ken,
    You mean you want to copy these specifc columns to a different sheet.Please attach a sample

  3. #3
    Forum Contributor
    Join Date
    05-01-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    822

    Re: VBA to return multiple columns

    Hi,

    Yes i mean i need to return specific columns rather than a range of columns.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA to return multiple columns

    Ken,
    Are you referring to the above, or you have a different code? If it is the above code, you want to return column A, column M, column AA column CJ. The code as it is retrurns 7 columns, but you want these columns? Right?

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA to return multiple columns

    Please Login or Register  to view this content.
    Last edited by AB33; 02-14-2013 at 11:00 AM.

  6. #6
    Forum Contributor
    Join Date
    05-01-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    822

    Re: VBA to return multiple columns

    You are a star..

    thank you so much

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA to return multiple columns

    Ken,
    You are welcome!
    If you are satsified with the solution provided, please close this thread as solved.

  8. #8
    Forum Contributor
    Join Date
    05-01-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    822

    Re: VBA to return multiple columns

    Thanks, the code doesn't like this bit;

    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA to return multiple columns

    I think it would be easy to get rid of that line, but if you want just to copy values only, I have amended the above and see if this works for you.

  10. #10
    Forum Contributor
    Join Date
    05-01-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    822

    Re: VBA to return multiple columns

    Many thanks again

  11. #11
    Forum Contributor
    Join Date
    05-01-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    822

    Re: VBA to return multiple columns

    I've just run this code again and attached what the output looks like, it seems the macro code is pasted into one of the cells???
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA to return multiple columns

    Ken,
    It is really weird!

    I do not know what happed, but seems the code has copied the code itself on the cells. I have not come across this issue before. I have now amended the first part of the code. There is no need to loop through the sheets- You ony have one sheet, but I have not checked the rest of your code. It now seems to work. Please see attached. I have changed same of the data on the first and last cell in to formulas to test the code and looks okay. Let me know if you have any issue.
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    05-01-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    822

    Re: VBA to return multiple columns

    Ah well, it works now.

    Thank you very much

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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