I have quite a bit of data processing to do and i would really appreciate some help to make it go faster. I have recorded a macro but I am having 2 problems with my coding.

I have two spreadsheets open, Lets call them A and B. I want to copy and paste 10 rows from A into B.
The problem that I am having with my coding is that I don't want to copy and paste the same rows from A into B everytime.
Rather, I want to copy 10 rows down from the currently selected row in A and then paste them into B. And after they have been pasted in B, return to A and select the 11th row so that the next time the macro is run it goes in a copy/paste sequence of 10 rows at a time.

here is what the coding currently looks like for this operation:

Windows("data measurement_09-09-08_0630.lvm").Activate
Application.CutCopyMode = False

My other problem is that Spreadsheet B titled above as Windows("data measurement_09-09-08_0630.lvm")., is not constant. It will be a different spreadsheet everytime i run the macro. So i think the solution is to paste the copied rows from sheet A into the "previously activated sheet" (which would be B). There must be a way to code for this.

hopefully my questions are understandable and I would really appreciate any response.

6 Years
Discussion Span
Last Post by AndreRet

If I understand the first part correctly, try the following -

Dim xRowFrom As Integer
Dim xRowTo As Integer

xRowFrom = 1551 +10 'Here you will add the last row copied previously and add 10 rows on to copy from.
xRowTo = 1570 'Do the same here or just add + and the amount of rows to copy.


The second part, use the spreadsheet name -


Use an if then statemet. if frm.name = "thename" then....

Edited by AndreRet: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.