Combine two Macro Codes together

  • Hi y'all


    I am new at VBA and on this forum. Hopefully, you can help me :S
    I have some difficulties with doing the following:
    I have written several macros which look up the correct values (from different sheets) with the desired date.
    I will share a part of my syntax.


    This works perfectly per row, because I add the dates manually.
    Now I want this to work automatically, but I have difficulties writing the syntax.


    I have a macro code which automatically fills the dates between the last updated date and the current date (see second code).
    With the third code, I tried to see if it possible for each new date that the amount of the previous date is added with 4:


    I have tried to nest the first syntax within the second syntax and switch last_r2 with i, but this did not work.
    In short, I want to maintain the functionality of the first syntax combined with the autofill between two dates.

    Hopefully, I explained my problem correctly and hopefully someone can help me in the right direction


    In advance I would like to thank you for taking the time to read my thread :D

  • Re: Combine two Macro Codes together


    Not quite clear as to what you want.


    Perhaps a sample workbook so I can see some data and some notes in the workbook would be helpful?


    When you click reply there will be a new button labeled go advanced, click on that button then there will be a paperclip icon in the toolbar, click on that icon and follow the instructions to upload a workbook.

  • Re: Combine two Macro Codes together


    Forgetting your code, can you just explain what you want to do now?


    What do you want to enter, or what do you specifically want the code to do and be specific as to what you want the code to look at.


    For instance you could say I want an input box to come up and I will type a beginning and ending date and I want the data from sheet ? that falls in this date range copied to sheet? and the columns to fit the new data.


    I don't want to read your code to figure it out, I want specifics as to what you want to happen, how it will happen and what data it is based on.

  • Re: Combine two Macro Codes together


    NewbieVBA - Perhaps you could share your solution so that others can see how you managed it?


    skywriter - for future reference, you can type [noparse][sw]*[/sw][/noparse] which will generate a peice of text explaining how to attach a sample workbook - save you a few keystrokes :)

  • Re: Combine two Macro Codes together


    @ SO
    I took my syntax and placed into a loop like this:


    And it works :)

Participate now!

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