Modifiy VBA code to paste to Next available Colunm

  • Re: Modifiy VBA code to paste to Next available Colunm


    Quote

    However, I have found that some data that are in white cells are also required.


    Which white cells?

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Modifiy VBA code to paste to Next available Colunm


    Try the attached file.


    Before running the code you will need to open every Branch file and make 2 changes to the Warehouse Sheet:


    Cell A35: change Gross Profit to Gross_Profit


    Cell A64 change Overheads to Overheads_

  • Re: Modifiy VBA code to paste to Next available Colunm


    Hi KJ
    Fantastic.


    I made the change to one file and all the data that I want pasted correctly.


    Ill make the change to all the files and it should give me the same result.


    Thanks a lot for taking the time to help me. You have been great as usual.

  • Re: Modifiy VBA code to paste to Next available Colunm


    Hi KJ
    I have been running the macro for a while now and it is working perfectly.


    However, I am having trouble ensuring that the yellow cells remain the same colour at all times. Many people have access to these files and sometime they change the yellow colour to something else and this causes the macro to fail.


    If this is not too much to ask, Is there any way you can modify the macro so it picks up the content of the yellow cells even if they are different colours?


    Let me know your thoughts.


    Thanks

  • Re: Modifiy VBA code to paste to Next available Colunm


    To try and modify the code to get just the required cells gets very complicated because the required cells are different for every sheet.


    The only work around I can think of is going to be a mind-numbing exercise for you!


    If you go to every town file and with the sheets: "Retail", "Fleet", "Warehouse Solutions", "Rentals", "Service" then, in Column B only, set a conditional format for all the yellow cells and all cells with no fill, but which do have a value, and set a conditional format for each of those cells with the following formula:


    =Len(B12)>=0


    Change the cell reference (B12) to suit each cell, in the case of cells that have no fill, but a value, make sure you click the 'No Color' button when setting the format DO NOT make the colour white!


    When all that is done is a user tries to change the colour of any of the cells required by the code then the colour change will not be allowed and the colour will immediately revert to what it should be.


    Hope that helps.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Modifiy VBA code to paste to Next available Colunm


    Hi KJ
    Thanks for heading me into the right direction.


    below code was mostly done using the macro recorded, and it basically sets the conditional formatting for all the required cells to their appropriate colour.


    Could you modify the code so it:
    -Choose a folder
    -Select files
    -For each file, run the code below
    -Save each file
    -Exit


    I could just open every file and run the macro but I thought by adding above, you can save me a lot of work.


    Thanks


  • Re: Modifiy VBA code to paste to Next available Colunm


    Try this

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Modifiy VBA code to paste to Next available Colunm


    You're welcome

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Modifiy VBA code to paste to Next available Colunm


    Hi KJ
    There are two more cells highlighted in yellow that I would like the macro copy to the master workbook.


    Cell B5 in " service " and Cell B5 in " Rentals" tab. Both are highlighted the same yellow as the other yellow cells.


    How do I modify the macro so it picks up these two cells too?


    Thanks

  • Re: Modifiy VBA code to paste to Next available Colunm


    You're welcome

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

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