+ Reply to Thread
Results 1 to 4 of 4

Organize tables by type and date

  1. #1
    Registered User
    Join Date
    03-20-2023
    Location
    Brasil
    MS-Off Ver
    365
    Posts
    6

    Organize tables by type and date

    Good afternoon everybody! I have 02 tables, which I need to analyze and consolidate the values ​​by ACTIVE and TYPE, separating the values ​​by 31/12/2021 and 31/12/2022. I have code that works correctly until halfway through, then it returns wrong values. I've tried everything, but I couldn't identify the code error. Would anyone know where I went wrong?
    To make it easier I'm posting the spreadsheet with the tables and the code to test.

    Anyone who can help me, I'm immensely grateful.

    Note: In respect of the rules, I inform you that this question is only posted here.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: Organize tables by type and date

    When your loop goes thru table 1, your loop goes from 1 to tabela1.Rows.Count

    However, if you check to see the value of tabela1.Rows.Count it's only 14 because your table is set to 14 rows.. so to properly loop thru the table you would need to set your loop from 5 to (tabela1.Rows.Count + 5) or you could use

    Please Login or Register  to view this content.
    instead of

    Please Login or Register  to view this content.
    For example;

    Please Login or Register  to view this content.
    I only checked that first loop but my guess is the same problem applies to the other table's loop as well

  3. #3
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Organize tables by type and date

    I couldn't tell what the issue was so instead I wrote a solution with a scripting dictionary that ensures you end up with a unique list of combinations. The code then populates the array with the relevant data. I commented the code to describe what it does.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-20-2023
    Location
    Brasil
    MS-Off Ver
    365
    Posts
    6

    Re: Organize tables by type and date

    maníaco, your code worked perfectly! 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)

Similar Threads

  1. [SOLVED] Match Type and Count with IDs and organize my Type and Count
    By rz6657 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-01-2021, 02:44 PM
  2. Organize Pivot Table Entries by date
    By skybr8ker in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-17-2021, 12:31 PM
  3. [SOLVED] Pivot tables, organizing data, best way to organize.
    By israelalvarado in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 02-28-2017, 07:07 PM
  4. Macro to help organize the directories by date
    By GiuliaPP in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-11-2016, 03:34 PM
  5. Replies: 3
    Last Post: 08-15-2015, 10:20 AM
  6. Re-organize date and units into different formats
    By will40 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-29-2012, 01:30 AM
  7. Organize data into sheets by Date
    By cyanidepwns in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-17-2010, 05:19 PM

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