ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy to Next Blank Row of Different Workbook (https://www.excelbanter.com/excel-programming/447595-copy-next-blank-row-different-workbook.html)

JamesWilliams

Copy to Next Blank Row of Different Workbook
 
Hello,

I'm new to VBA so I need some help with the following. I have a working workbook and I want to dump all of the data into a master workbook in the next blank row. The working file will have a different number of rows of data, so I need the range to select the data in the working file based on what is in there (the range will start at B4). I think I need xldown and right?!

I've searched for an answer before posting but none of the other threads quite match what I need.

Thanks,

James

pascal baro

Copy to Next Blank Row of Different Workbook
 
Hi

.... (the range will start at B4). I think I need
xldown and right?!

I would say that you'd better start from xldown towards xlup. Just because, if you go the other way round, if there is an empty cell in your range, this will be your last row and you just might half way to the last row...


example of xlup

dim lastr as long
lastr = sheet1.cells(rows.count, 2).end(xlup).row

the number 2 means column 2 or column B.

Pascal Baro
http://multiskillz.tekcities.com/


All times are GMT +1. The time now is 04:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com