Match Cells & Shift Rows Down If No Match

  • Re: Matching Cell From 2 Tables And Shitfing Rows Down If Cell Does Not Match


    Basically what I am trying to achieve is this:


    If cell B1 < cell M1, shift cells M1:V1 down 1 row
    If cell B1 > cell M1, shift cells B1:K1 down 1 row
    If cell B1 = cell M1, Look at next row cell B2 and do the procedure again.


    Any advice?


    Cheers

  • Re: Matching Cell From 2 Tables And Shitfing Rows Down If Cell Does Not Match


    I got the first 2 parts working



    Need help with the third part on what if its equal or how to loop the procedure again for the next row

  • Re: Match Cells From Tables &amp; Shitf Rows Down If No Match


    I like the title change from "Shitfing" to "Shitf" LOL


    If I had title-changing powers, as a trained technical author and proof-reader, I would get rid of these typos!

  • Re: Match Cells From Tables &amp; Shift Rows Down If No Match


    Oops... ok i hope its changed...
    To ByTheCringe2... sorry about that X( any solution to my problem?

  • Re: Match Cells From Tables &amp; Shift Rows Down If No Match


    Hi DTWK,


    I'm probably going to regret posting this code... because your probably going to ask me what it does, and not being funny, but I really dont have time to explain it. I wrote this a long time ago to do exactly what you are asking. It Shifts rows down until they match.


    They ONE provisio is that columns being 'checked' MUST be sorted, and I acknowledge you have asked for this help in a seperate post.


    Try running the code as is it is... if you run into odd problems it will be because the sort functions at the start of the code arent working, because you have alpha numerics in both columns. If this is causing you a problem, then take the advice that Dave posted in your other thread about sorting the alpha numeric data before executing my code AND remove the sort methods below from my code. However, There is one sort method for each column being checked so it might actually work, because both columns are being sorted the same way.... so it might work.


    The three important Constants are
    First column - which is now set to "2" to represent Column B in your sample data
    Second Column - which is now set to "13" to represent Column "M" in your sample data
    Column Width - which indicates the number of columns wide that have suffled down each time a row doesnt match.... Currently set to 10 to match your sample data.


    There is also colour coding which I used to highlight rows that match (Green) and rows that dont match (Red). This can be switched off with the other constant Colour_Code.




    Happy debugging. Code provided as is. Sorry, but I am really busy in work today.
    Ger

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

  • Re: Match Cells From Tables &amp; Shift Rows Down If No Match


    Thanks ger for that long post... much appreciated for your efforts... although it doesnt work perfectly, i think i could work on it for the time being... cheers

  • Re: Match Cells &amp; Shift Rows Down If No Match


    Dear DTWK


    if it is too late I think this post may help u. Actually I'm not much clever in coding.
    Take the Excel File I have attached. There (S No) is the unique Number by which all data are sorted.


    forum.ozgrid.com/index.php?attachment/37015/


    ==================================================


    ======================================================



    Regard
    Booli

  • Re: Match Cells &amp; Shift Rows Down If No Match


    Hello booli,


    Welcome to Ozgrid.
    Thanks for posting a potential new solution, albeit the thread you posted in is over five years old.


    Please take some time to read throuhg the forum rules.


    Per the Forum Rules, VBA code must be wrapped in code tags, which you omitted.
    I've added the tags for you this time; please be sure to use them in future posts when needed.


    See the link in my signature for more information on how to use tags.



    [COLOR="navy"]How to use code tags[/COLOR]
    [noparse]

    Code
    [/noparse]
    [COLOR="blue"]Your code goes between these tags[/COLOR]
    [noparse]

    [/noparse]

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!