Discussion Locked

excel macro help!

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I need a macro that will cut a selected row from a master sheet and paste it into a secondary sheet but
only paste to the next blank row (eg: sheet 1 row 1 - cut and paste into sheet 2 row ? if empty)

I've recorded a macro that will cut and paste a row to its equivalent row but the rows being moved could be 10 rows apart which is what i get in the second sheet at the moment.

3 replies

by answerman

copy from one sheet to next available row on another

Trying to copy a row of information compiled from various cells and linked to one row.
This row is to be copied from sheet1 and pasted to the next available row on sheet "database"
using:

Private Sub CommandButton4_Click()
Dim Source As Range
Dim Target As Range
Set Source = Workbooks("mastertransmittal_rev10.xls").Sheets("Sheet1").Range("A3").CurrentRegion
Set Target = Workbooks("mastertransmittal_rev10.xls").Sheets("database").Range("A1").End(xldown).Offset(1, 0)
Workbooks("mastertransmittal_rev10.xls").Sheets("database").Select
nextrow = Application.WorksheetFunction.CountA(Range("a:a")) + 1
Source.Copy Target
End Sub

by sth2001a

I spent more time in Lotus 123 than Excel on issues like this. Anyhow, I had a similar issue where (end-right,right) would solve such a problem. I'm not sure what the comparable command in Excel is but the concept is the same. The macro should take your info to the next page, then an "end-right" or "end-right-right" command should get you to the next open cell regardless of the length of data present.

This discussion is closed to new replies.