VBA Code to Match the Value from Sheet1 Row 6

  • Glad this could help you out :)


    Thanks a lot for your Thanks ... AND for the Like :thumbup:

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Carim, can you please convert this in code I mean when i run the code it will paste the result. Right now code is making a formula. I have tried to change but could not.

    Hello,


    No problem at all ... But you should know a macro will offer you less flexibility ...


    Let me quickly prepare the conversion for you ...

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Your previous code helped me a lot for my working thank you so much.


    I need some more favor if you are willing to provide i will really appreciate the help.


    The previous code just pasting the data of "Gorss Wage".


    Now the code will paste the data of three rows name are added below (that will be Sheet("Data") row 7,8 and 9.


    00202_0000 - Gross Wage

    00202_0000 - Gross Lable

    00202_0000 - Gross DD


    Code will take the first number from Col"B" and will match that number in Col"E" if that number matches then code will paste that matches row data into Sheet("Pastedata") as per same sequence that previous code was doing.

  • Will make all the adjustments to your new file structure ... as soon as I have a moment ...


    BUT


    you will admit ... it would have been a lot more effective to post your first sample Excel file ....

    as a good representation of your existing working file ...;)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • NO, NO I think i could not elaborate that what i want from the new given sheet, Please Do not delete the other tabs let me explain you briefly that what i want.


    The previous code just pasting the data of "Gorss Wage".


    Now the code will paste the data of three rows name are added below (that will be Sheet("Data") row 7,8 and 9.

    THE CODE WILL NOT USE SUM/SUMIF IT WILL AS IT PASTE THE ROWS.


    00202_0000 - Gross Wage

    00202_0000 - Gross Lable

    00202_0000 - Gross DD



    Code will take the first number from Col"B" and will match that number in Col"E" if that number matches then code will paste that matches row data into Sheet("Pastedata") as per same sequence that previous code was doing BUT WILL NOT sum/sumif.


    Now there is one more step further that is whatever the result is appear in Sheet("Calc").Range("AE10:AG10") after pasting the data into Sheet("Pastedata") for the first *number* that is "00202_0000".


    That metnioned Sheet("Calc").Range("AE10:AG10") will be copied and paste into Sheet("Final").Range("E2:G2")


    after that Code will go for 2nd number 00203_0000 then for 3rd 00204_0000 an so on.


    If the the CODE has completed the calculation for 1st number. Then same activity would repeat for 2nd number then 3rd and 4th an so on.



    THIS IS EXACTLY WHAT I WANT FROM THE NEW SHEET.

  • Quite honestly ... it is becoming very very confusing :S

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • I do not know how to elaborate it.


    Let me try again.


    We do not need to use SUMIF to SUM the whole data, we will pick ColB first Number number that is and will match in Col"E"

    and that number is just available in circled cells so row 7,8 and 9 data will be pasted into Pastedata Sheet.


    after that whatever the result is appear in Sheet Calc that result will be paste into Sheet final.


    then code will go for 2nd Number now same process will be repeat for 2nd number now code will pick ColB 2nd Number from ColB because first number has been completed.


    then go for number 3 and so on



    A loop will create to repeat the process i think.

  • I have create separate worbooks for the result and Code i am looking for.


    When code will run It will take Col"B" first value [Blocked Image: https://www.ozgrid.com/forum/c…asted-from-clipboard-png/] and paste Row 7, 8 and 9 into Sheet Pastedata as i pasted in attached Book1 and after that whatever value is appear in Sheet("Calc").Range("AE10:AG10") that will be copied and paste into Sheet("Final").Range("E2:G2").


    Now Code did first JOB and will go for second.


    Code will pick 2nd number [Blocked Image: https://www.ozgrid.com/forum/c…asted-from-clipboard-png/] and paste row 13, 14 and 15 into Sheet Pastedata as i pasted in attached Book2 and after that whatever value is appear in Sheet("Calc").Range("AE10:AG10") that will be copied and paste into Sheet("Final").Range("E3:G3").



    Now Code did 2nd JOB and will go for third.



    Code will pick 3rd number 00204_0000 and paste row 20, 21 and 22 into Sheet Pastedata as i pasted in attached Book3 and after that whatever value is appear in Sheet("Calc").Range("AE10:AG10") that will be copied and paste into Sheet("Final").Range("E4:G4").


    I want that final result. from that code please have a look Carim,


    I know this is hectic. I would really appreciate your help.

  • Hello,


    In my humble opinion, you are over-complicating things by storing the same data several times in several different worksheets ...


    Let's try to clarify your entire workbook ... assuming your data is stored in the sheet 'Data'


    A. Step 1 : what needs to happen in your sheet ' Paste Data ' ?

    B. Step 2 : what needs to happen in your sheet ' Calc ' ?

    C. Step 3 : what needs to happen in your sheet ' Final ' ?


    Based on the example provided, if the 'Paste Data' sheet requires some type of consolidation based on the Sheet 'Data' , the other two sheets seem to be ONLY slightly different displays of the very same consolidation performed in 'Paste Data' ...


    Thanks for providing your clarification ...

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Hello,


    Glad to hear you have designed a solution for your problem ... :)


    Your code uses 3 Loops for quite important ranges ... which will slow down the whole process ...


    But, for a start ... do you really need to perform all your calculations till the year 2144 ...???

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

Participate now!

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