Copy and Paste Dynamic Range to First Unused Row of different Workbook

  • Hi all,


    I am importing some data into a workbook. I want VBA to clean the data and copy and paste the 'cleaned' data to the bottom of a range in the same book on a different worksheet. I'm struggling to get my head around UsedRange and how I can use that to copy and paste to the right places in the book. For some reason that i cannot fathom the last line of code seems to be being skipped - i.e. it's not running. Oddly, when I step through using f8 it picks up this line of code. Not sure why that would be. Any help very much appreciated.


    Code below:


  • Re: Copy and Paste Dynamic Range to First Unused Row of different Workbook


    Hi, I have found a means to do what I want to do but it only works when I step through the code, not when I run the code in full. I have no idea why. The new code I have is below:



    When I step through it executes exactly as I expect it to. However when I run the macro it seems only to execute to the line of code below, and no further:


    Code
    .Range("P4").Value = "Debt Year"


    I am genuinely baffled. Any help? Why would it run differently in different execution forms?

Participate now!

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