+ Reply to Thread
Results 1 to 11 of 11

VBA extract certain parts of array

  1. #1
    Forum Contributor
    Join Date
    01-16-2013
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    136

    VBA extract certain parts of array

    Hi,

    I've put some data in a table that gives marks into an array and want to display it in three separate tables. One for Maths only another History only and Finally Biology only.

    I can do the first one but is it possible to do this for History and maths. See attached showing desired output.



    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: VBA extract certain parts of array

    There's no data / output in the workbook.
    MatrixMan.
    --------------------------------------
    If this - or any - reply helps you, remember to say thanks by clicking on *Add Reputation.
    If your issue is now resolved, remember to mark as solved - click Thread Tools at top right of thread.

  3. #3
    Forum Contributor
    Join Date
    01-16-2013
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    136

    Re: VBA extract certain parts of array

    Correct attachment added
    Attached Files Attached Files

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: VBA extract certain parts of array

    Hi batchjb69,
    maybe so
    Please Login or Register  to view this content.

  5. #5
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: VBA extract certain parts of array

    Try this for your data in "A1:D5"
    Results in rows below:-
    Please Login or Register  to view this content.
    Regards Mick

  6. #6
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: VBA extract certain parts of array

    Try this in a new module:
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    01-16-2013
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    136

    Re: VBA extract certain parts of array

    Thanks and what would I do if I wanted two columns of data for example History and Biology. If I had a big spreadsheet with say 25 columns of data is it possible to put the data in an array and extract and variation of column e.g columns 1, 5 & 8 or 3,20 & 25 into a new table. I know it can be done with copy and paste but with large data sets this is very slow.

  8. #8
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: VBA extract certain parts of array

    If your data is in the same format, then you can just change the "rng" variable to whatever your full range is. So if you have one column of names and 15 columns of classes, then this:
    Please Login or Register  to view this content.
    Becomes:
    Please Login or Register  to view this content.
    Is that what you meant?

  9. #9
    Forum Contributor
    Join Date
    01-16-2013
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    136

    Re: VBA extract certain parts of array

    More if you had say 20 columns is there a way to put multiple data into another sheet. After putting the data set into an array.

    e.g for output one sheet you could have data from columns 1,2 and 3 of input sheet


    sheet 2 you could have data from columns 1, 2 ,5 & 7 of input sheet

    sheet 3 you could have data from columns 1,8, 9 ,15 & 18 of input sheet

  10. #10
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: VBA extract certain parts of array

    This might help.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  11. #11
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: VBA extract certain parts of array

    See the array line in bold - change the numbers in there to include whichever columns of data you want copied. Run it on the Test sheet in the attached file. Hope that helps. MM.
    Please Login or Register  to view this content.

+ 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. Formula to extract or remove specific parts of text
    By chrisellis250 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-12-2017, 12:13 PM
  2. [SOLVED] Extract numeric value from string, and multiply by parts Qty
    By Anxiety in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-01-2015, 11:09 AM
  3. Formula to extract parts of text string
    By edorris3 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-11-2014, 10:22 AM
  4. SUBSTITUTE or EXTRACT parts of a cell
    By ElMasry in forum Excel General
    Replies: 6
    Last Post: 07-14-2010, 01:56 PM
  5. Totalling Sum of Parts in a 2 column array.
    By steev_jd in forum Excel General
    Replies: 2
    Last Post: 04-26-2006, 10:25 AM
  6. [SOLVED] Extract certain parts of string
    By djDaemon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-02-2006, 03:45 PM
  7. RE: Extract certain parts of string
    By djDaemon in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-02-2006, 11:35 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