Results 1 to 3 of 3

Extract Reconciling Items

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2024
    Posts
    2,888

    Extract Reconciling Items

    I have a sheet called Statement and a and sheet called Purchase Ledger


    I have writen code to compare the Reference Number in Col F and Value in Col G on sheet "Statement" with Col F and I on sheet "Purchase Ledger"

    Where items on sheet " Statement" does not match sheet Purchase Ledger, then extract to sheet "Statement Reconciling Items"

    Where items on sheet "Purchase Ledger" does not match sheet "Statement", then extract to sheet "Purchase Ledger Reconciling Items"


    I have manually extracted the data


    It would be appreciated if someome could kindly amend my code as it is not extracting the data correctly


     Sub ReconItemsList()
    Dim r As Range, arr(), k&
    With CreateObject("scripting.dictionary")
        For Each r In Sheets("Purchase Ledger").Range("f2:f" & Sheets("Purchase Ledger").Cells(Rows.Count, "f").End(xlUp).Row)
            If Not .exists(r.Value2 & "|" & r.Offset(, 3).Value2) Then
                .Add r.Value2 & "|" & r.Offset(, 3).Value2, r.Value2 & "|" & r.Offset(, 3).Value2
            End If
        Next r
        
        For Each r In Sheets("Statement").Range("f2:f" & Sheets("Statement").Cells(Rows.Count, "f").End(xlUp).Row)
            If Not .exists(r.Value2 & "|" & r.Offset(, 1).Value2) Then
                ReDim Preserve arr(8, k)
                arr(0, k) = r.Offset(, -5).Value2 '(5 cols back from Starting Col F)
                arr(1, k) = r.Offset(, -4).Value2
                arr(2, k) = r.Offset(, -3).Value2
                arr(3, k) = r.Offset(, -2).Value2
                arr(4, k) = r.Offset(, -1).Value2
                arr(5, k) = r.Value2
                arr(6, k) = r.Offset(, 1).Value2
                arr(7, k) = r.Offset(, 2).Value2
                k = k + 1
            End If
        Next r
    End With
    With Sheets("Statement Recon Items")
    On Error Resume Next
    
        .Range("a2").Resize(UBound(arr, 2) + 1, UBound(arr, 1) + 1).Value = Application.Transpose(arr)
        .UsedRange.Borders.LineStyle = xlContinuous
        .UsedRange.Columns.AutoFit
    End With
    Erase arr
    
    k = 0
    With CreateObject("scripting.dictionary")
        For Each r In Sheets("Statement").Range("f2:f" & Sheets("Statement").Cells(Rows.Count, "f").End(xlUp).Row)
            If Not .exists(r.Value2 & "|" & r.Offset(, 1).Value2) Then
                .Add r.Value2 & "|" & r.Offset(, 1).Value2, r.Value2 & "|" & r.Offset(, 1).Value2
            End If
        Next r
        
        For Each r In Sheets("Purchase Ledger").Range("f2:f" & Sheets("Purchase Ledger").Cells(Rows.Count, "f").End(xlUp).Row)
            If Not .exists(r.Value2 & "|" & r.Offset(, 3).Value2) Then
                ReDim Preserve arr(11, k)
                arr(0, k) = r.Offset(, -5).Value2 '(5 cols back from Starting Col F)
                arr(1, k) = r.Offset(, -4).Value2
                arr(2, k) = r.Offset(, -3).Value2
                arr(3, k) = r.Offset(, -2).Value2
                arr(4, k) = r.Offset(, -1).Value2
                arr(5, k) = r.Value2
                arr(6, k) = r.Offset(, 1).Value2
                arr(7, k) = r.Offset(, 2).Value2
                arr(8, k) = r.Offset(, 3).Value2
                arr(9, k) = r.Offset(, 4).Value2
                arr(10, k) = r.Offset(, 5).Value2
                k = k + 1
            End If
        Next r
    End With
    With Sheets("PL Recon Items")
        .Range("a2").Resize(UBound(arr, 2) + 1, UBound(arr, 1) + 1).Value = Application.Transpose(arr)
        .UsedRange.Borders.LineStyle = xlContinuous
        .UsedRange.Columns.AutoFit
    End With
    Erase arr
    
    End Sub
    Attached Files Attached Files
    Last edited by Howardc1001; 02-02-2023 at 12:26 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] extract items into multiple items for (4) (5)(6) items for multiple cells and columns
    By Ali-M in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-23-2022, 03:52 AM
  2. [SOLVED] compare References on 2 sheets and extract reconciling differences
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 08-05-2022, 08:45 AM
  3. Extract COS ITEMs only
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-06-2021, 05:09 AM
  4. [SOLVED] macro to extract reconciling Differences
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-07-2021, 09:28 AM
  5. [SOLVED] Extract and return a distinct and duplicate items list separately from a two list items
    By Mohammad Munawar in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-14-2020, 07:42 AM
  6. Reconciling Items using Excel
    By theshark43 in forum Excel General
    Replies: 4
    Last Post: 05-11-2010, 11:06 AM
  7. Extract Unique Items
    By GreenLotus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-15-2007, 09:00 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