Excel VBA copying rows of data

  • Hey,


    Would appreciate if anyone can help me with the following.


    I have created a dummy worksheet to give some guidance. I want to copy the data from the Market data tab into the template data tab, but only the rows that meet the condition in Column C to be Albania. Also I then don't want to copy over the complete row, but only everything under Address 1 and to the right of it. Any help again would be massively appreciated.


    Thanks in advance!

    • Best Answer

    This could be a macro for you to be pasted in a standard module.

  • Spice.

    Selected a post as the best answer.
  • Of course no worries!


    I do have a follow up question if that is okay. How do I go about changing the code so that the data copied over is copied starting from a specific cell and not just the first unused row in the sheet. Say I wanted to data to copy into the Template Data sheet but only starting from A20 on the sheet, how do I do that.


    Thanks in advance.

  • So that means that you need a static range for pasting. No need to use variable 'lr2':

  • Thank you again for this rollis13. Could you help on a couple more problems I have if possible please. I've attached the excel sheet and copied the code again here.


    1) How would I copy over the rows of data from market data to template data and ensure the formatting is kept the same? (compact rows where everything fits and is adjusted)

    2) If market data and template data were in two separate workbooks, how would I change the code to open up market data workbook copy over the rows of data and then close the market data workbook?

    3) How can I copy the rows but run a formula on cells T4 to Y4 in market data so the the currency is converted to EUR (divide all these cells by FX value in Column E) and then copied over to template data? Unfortunately, I can't run this conversion first as the data is going to be used in this format and so the conversion will have to be done throughout the macro process.



    Any help is massively appreciated, thank you in advance!

Participate now!

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