+ Reply to Thread
Results 1 to 16 of 16

Macro for removing reversal entries

  1. #1
    Registered User
    Join Date
    02-11-2019
    Location
    india
    MS-Off Ver
    Microsoft 365 MSO
    Posts
    33

    Macro for removing reversal entries

    Hi

    I want a macro which would remove the entries if there is a debit and credit of the same amount (column 'E') of the same customer (column 'B') of the same document type (column 'C') on the same date (column 'D').

    I have highlighted one such example in yellow (Row 114 & 115).

    Debits are amounts in positive and credits are in negatives.

    Thanks in advance!

    https://drive.google.com/open?id=13j...19SATfOS3xK1fh

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Macro for removing reversal entries

    Hi !

    Attach a workbook with a crystal clear explanation …

  3. #3
    Registered User
    Join Date
    02-11-2019
    Location
    india
    MS-Off Ver
    Microsoft 365 MSO
    Posts
    33

    Re: Macro for removing reversal entries

    Hi

    So basically, if Columns B, C and D of two rows matches and the amount column ( column E) corresponding to those two rows has a positive amount for one entry and negative amount for another entry then those two rows has to be removed.

    I have attached a simpler worksheet in which the rows marked in yellow are the rows to be removed.

    Can you please help me with a macro to do this job?

    Thanks!
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Try this !


    So basically according to your attachment a demonstration as a beginner starter :

    PHP Code: 
    Sub Demo()
       Const 
    "=B1&""#""&C1&""#""&D1&""#"""
         
    Dim C&, L&, R&, T%(), EVWX
             C 
    = -1
             Application
    .ScreenUpdating False
        With 
    [A1].CurrentRegion.Columns
             L 
    = .Rows.Count
             ReDim T
    (1 To L0)
             
    = .Item(5).Value2
            
    .Item(6).Formula F
             V 
    = .Item(6).Value2
            
    .Item(6).Formula "&E1"
             
    = .Item(6).Value2
         
    For 2 To L 1
             
    If T(R0) = 0 Then
                X 
    Application.Match(V(R1) & -E(R1), W0)
                If 
    IsNumeric(XThen If T(X0) = 0 Then T(R0) = 1T(X0) = 12
             End 
    If
         
    Next
         
    If 0 Then
            
    .Item(6).Value2 T
            
    .Resize(, 6).Sort Cells(16), xlAscendingHeader:=xlYes
            
    .Rows(":" L).Clear
         End 
    If
            .
    Item(6).Clear
        End With
             Application
    .ScreenUpdating True
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  5. #5
    Registered User
    Join Date
    02-11-2019
    Location
    india
    MS-Off Ver
    Microsoft 365 MSO
    Posts
    33

    Re: Macro for removing reversal entries

    Thanks a lot!

    Can you please explain the code?

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow

    Except for Match which is an Excel worksheet function (so to see in Excel help) all is yet in the VBA inner help ‼
    So place the text cursor on a statement and hit the F1 key then just read, that's it !
    Easy as I just followed a child logic like any beginner can apply.
    To summarize : an helper column is used for a concatenation formula in order to mark the rows to clear …

  7. #7
    Registered User
    Join Date
    02-11-2019
    Location
    india
    MS-Off Ver
    Microsoft 365 MSO
    Posts
    33

    Re: Macro for removing reversal entries

    Thank you!

  8. #8
    Registered User
    Join Date
    02-11-2019
    Location
    india
    MS-Off Ver
    Microsoft 365 MSO
    Posts
    33

    Re: Try this !

    Hi,

    Thank you for this awesome code.

    But, this macro does not delete all the reversals in a sheet.
    If the number of line items is more it deletes only a few. So I have to run the macro again and again.

    Can you help me edit this code so that the macro would repeat its task until all the reversals are deleted?

    Thanks in advance.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Macro for removing reversal entries

    If duplicates match from the order of appearance.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    02-11-2019
    Location
    india
    MS-Off Ver
    Microsoft 365 MSO
    Posts
    33

    Re: Macro for removing reversal entries

    Hi,

    It is showing an error!Error.png

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Macro for removing reversal entries

    Change to
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    02-11-2019
    Location
    india
    MS-Off Ver
    Microsoft 365 MSO
    Posts
    33

    Re: Macro for removing reversal entries

    Hi,

    Although it is working in the sample sheet, it's not working in my attached sheet.

    Could you please help me with this?


    https://finadvantagecoin478-my.share...ke1Pw?e=WdkUkP

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Macro for removing reversal entries

    You should upload your workbook here.
    If it is too big, zip it, or just enough rows of data that shows how you want it.

    Shutdown my pc already, so I wil look at it tomorrow.

  14. #14
    Registered User
    Join Date
    02-11-2019
    Location
    india
    MS-Off Ver
    Microsoft 365 MSO
    Posts
    33

    Re: Macro for removing reversal entries

    I had attached the link to my workbook in my previous reply.
    Attaching the link here again.

    For your understanding, row no. 106 and 107 have to be removed (just an example).

    Thank you!

    https://drive.google.com/file/d/1ufY...ew?usp=sharing
    Last edited by yogyata26; 07-04-2021 at 01:23 PM.

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Macro for removing reversal entries

    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    02-11-2019
    Location
    india
    MS-Off Ver
    Microsoft 365 MSO
    Posts
    33

    Re: Macro for removing reversal entries

    Works flawlessly!

    Thank you.

+ 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] removal of Reversal Entries
    By topnotchthrillr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-15-2015, 11:42 AM
  2. Generating a unique list of entries but removing some entries.
    By Kramxel in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-14-2015, 11:42 AM
  3. Removing entries using Selection.Autofilter, but keeping the greatest 100 entries?
    By artenry in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-04-2014, 03:51 PM
  4. Removing Multiple Entries
    By ajchv6 in forum Excel General
    Replies: 2
    Last Post: 06-14-2012, 04:28 PM
  5. Removing repeat entries in a long column of data entries
    By kaizhong1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-15-2010, 01:31 PM
  6. [SOLVED] SPREADSHEET SUMMARY MACRO REMOVING BLANK ENTRIES
    By piper in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-10-2006, 05:30 PM
  7. Removing duplicate entries.
    By dh01uk in forum Excel General
    Replies: 2
    Last Post: 01-13-2006, 11:55 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