Hi,
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:

Rows("1561:1570").Select
Selection.Copy
Windows("data measurement_09-09-08_0630.lvm").Activate
Application.CutCopyMode = False
ActiveSheet.Paste

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.
thanks

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.

Rows(xRowFrom:xRowTo).Select

The second part, use the spreadsheet name -

Spreadsheet2.Name

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.