Results 1 to 7 of 7

[Macro] Compare two columns, if cells differents, copy and delete cell

Threaded View

  1. #1
    Registered User
    Join Date
    11-16-2013
    Location
    France
    MS-Off Ver
    Excel 2007
    Posts
    4

    [Macro] Compare two columns, if cells differents, copy and delete cell

    Good afternoon to all

    I am stuck now for a whole day on creating a macro. I am actually quite a novice regarding VBA and so would really appreciate somebody to give me a hand with this.

    In the attached file, I have three columns, with the third showing discrepancies between the two firsts. Column A and C contain the same values + differences that I must highlight.

    What I am looking to do is that if value in E2 is negative, then copy/paste A2 in I2 and once pasted, delete cell A2 (moving cells up).
    However, if E2 is positive, then copy/paste C2 in J2 and once pasted, delete cell C2 (moving cells up).
    Then only make sure difference formula in E column is correct by copying from original cell E1 (should be done like this I think):

    Range("E1").Select
    Selection.AutoFill Destination:=Columns("E:E")
    Columns("E:E").Select


    Then only do the same for the next lines.

    This should result in having columns A and C completely equals and the different cells shown on the side.

    I hope my explanations are clear enough for you to understand, and I really thank in advance whoever will be able to help me with this.

    Cheers !
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Compare 2 columns, delete cells with no match
    By cmd in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-22-2019, 04:52 AM
  2. Compare Two Columns Between Two Worksheets, keep duplicates, delete others, copy new
    By navyav8er in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-14-2012, 03:59 PM
  3. Compare two columns and delete cell in one column if cell next to it is blank
    By jacobhandson in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-17-2011, 01:51 PM
  4. Macro to compare multiple columns then delete rows with older dates
    By azurememories in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-23-2011, 05:43 PM
  5. Macro to Compare to Cells and Delete Row
    By randolphoralph in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-24-2008, 04:33 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