VBA - Copy range that skips blanks and paste in another workbook

  • Hi everyone! This is my first post in this forum. Seems like a nice place!

    So I have a macro set up that will copy different ranges from one workbook to another. When the ranges are getting pasted, the macro will check if a specific cell is empty. If it is, the data will be pasted there and the next time the macro is used, the new data will be pasted below it. The issue occurs when one of the ranges has blank cells in it. For example, if leave the first 5 cells in a range empty and type in the 6th cell, the data will be pasted six cells down from the intended area. How do I make it so that if I have empty cells in that range, it will not affect the position of where the data gets pasted?

    In other words,

    Workbook A range K17-36 will be copied to Workbook B range F42-222.

    If range K17-20 are empty and K21 has data, it will be pasted to Workbook B in F47 instead of F42.

    How do I skip the empty cells and make the copied data paste starting at F42?

    I will post my code below.

    Thanks in advance!

Participate now!

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