+ Reply to Thread
Results 1 to 18 of 18

Please help me with making a Multidimensional Array

  1. #1
    Registered User
    Join Date
    04-10-2014
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    39

    Please help me with making a Multidimensional Array

    Hi,
    I'm struggling to write a multidimensional array.
    Could you please help?

    Here is what I’m trying to do...

    I have an excel sheet with the following data
    Row 1 Column P 10,500
    Row 2 Column P --------
    Row 3 Column P 10,500
    Row 4 Column P 6,000
    Row 5 Column P --------
    Row 6 Column P 6,000
    Row 7 Column P 10,500

    I wrote a loop to remove dupes but it only removes a dupe if the next cell is the same as the previous cell.

    I would like it to ignore the "--------" and remove any rows that have a repeat value in any cell in column P.
    So the output would look like this
    Row 1 Column P 10,500
    Row 2 Column P --------
    Row 3 Column P 6,000
    Row 4 Column P --------

    Thank you in advance for your help.

    Please Login or Register  to view this content.
    Last edited by learner99; 06-27-2014 at 11:16 AM.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Please help me with making a Multidimensional Array

    To get it quickly can you send an XLS sample of the data

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Please help me with making a Multidimensional Array

    Hi,

    Always try and avoid VBA (and especially loopiing code) when there is perfectly straightforward Excel functionality available.
    Filtering data is the fastest way I know of identifying data rows that need to be deleted. So in say Q1 enter

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Copy it down and filter column Q for the word "Delete", then select all the filtered rows and delete them.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    04-10-2014
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Please help me with making a Multidimensional Array

    please see attached for a test fileTest file.xlsx

  5. #5
    Registered User
    Join Date
    04-10-2014
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Please help me with making a Multidimensional Array

    Thank you for your feedback. The logic I'm working on is just one step in a macro I'm building. I think a loop inside a loop is the only way to check each cell against one another to get ride of the dupes.

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Please help me with making a Multidimensional Array

    Try
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-10-2014
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Please help me with making a Multidimensional Array

    Wow that's pretty cool!
    The only questions I have are, how do I change the logic to delete the rows instead of just the cells? And can you put some comments in the logic so I better understand what's going on. I'm assuming ObjDic is a virtual table. I've never seen that command used before.
    Thanks again!

  8. #8
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Please help me with making a Multidimensional Array

    The original purpose was "to write a multidimensional array" that was certainly why you were using "RowInfo()"
    If you want to delete rows we can do it without the array: Please confirm.
    About " put some comments " let's wait the final Procedure after the answer to the previous question
    Concerning "ObjDic" it's an collection object, see for more detail:
    http://www.snb-vba.eu/VBA_Dictionary_en.html (thank you snb)
    http://www.experts-exchange.com/Soft...ss-in-VBA.html

  9. #9
    Registered User
    Join Date
    04-10-2014
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Please help me with making a Multidimensional Array

    Yes I would like to delete the rows that have duplicate cells. I'd also like to keep the array process incase I need to add another column to filter off of.
    Hope that makes sense. And thank you for the links I will be checking them out.

  10. #10
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Please help me with making a Multidimensional Array

    See here after, of course some simplifications can be done versus the use of the array
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    04-10-2014
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Please help me with making a Multidimensional Array

    That's perfect! Thank you.

  12. #12
    Registered User
    Join Date
    04-10-2014
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Please help me with making a Multidimensional Array

    Hey PCI, I hate to bother you again but I have to make what I think is a minor change to the code and for some reason Its not doing what I was expecting.
    I had to add another column to check against.
    What I'm looking to do is run the current loop until the data in column L changes. Basicly when cell 1 doesnt match the next cell down the loop would start over. This is so I don't delete repeats that are needed farther down the list.

    I've attached test Data.
    Here is the code after I added logic.

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

  13. #13
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Please help me with making a Multidimensional Array

    I'm not sure to get it right.
    Previous macro is removing duplicate value, except when this value is "--------"
    How this can be done only when value in column L is changing?
    Can you send the final result you want from your file

  14. #14
    Registered User
    Join Date
    04-10-2014
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Please help me with making a Multidimensional Array

    Please see attached. The first tab is the input. Second tab is the output.
    Thanks again for your help.
    Attached Files Attached Files

  15. #15
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Please help me with making a Multidimensional Array

    Give a chance to next code
    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

  16. #16
    Registered User
    Join Date
    04-10-2014
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Please help me with making a Multidimensional Array

    Thank you for all the hard work on this! The code is way past my skill level. Can you add some comments so I can understand what's going on. I was thinking you would have use column L as a trigger to start the loop over when the number changed.

  17. #17
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Please help me with making a Multidimensional Array

    I will see to prepare you some explanations but not now, come back to me if in week there is still nothing sent.
    PCI

  18. #18
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Please help me with making a Multidimensional Array

    See here code with comments
    For DICTIONNARY info see
    http://www.snb-vba.eu/VBA_Dictionary_en.html
    Thanks to snb
    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. [SOLVED] If statement in a Multidimensional Array Help
    By learner99 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-16-2014, 12:21 PM
  2. Using the ReDim array function in a multidimensional array in excel
    By Doruli in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-05-2012, 01:43 PM
  3. Row copy within multidimensional array
    By guptaraja in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2010, 10:48 PM
  4. Multidimensional Array
    By sidd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2009, 09:57 PM
  5. Multidimensional array
    By gwithey in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 02-02-2009, 12:15 PM

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