Automatic cut and paste based on dynamic ranges

D

DangerMouse

Hi all,

I wish to update one worksheet (containing an XML export 'list') with
values from various distilled other worksheets.

Its quite a simple operation, on click of a macro button take all
'completed' rows from one work sheet and append onto the bottom of the
'master list' contained in another file.

Im guessing this involves dynamic rangest to automate, but from there
I'm a little stuck.

Any help will be fantastic.

Steve
 
J

JE McGimpsey

One way:

Dim rDest As Range
Dim rSource As Range

With Sheets("Source")
Set rSource = .Cells(1, 1).Resize( _
.Cells(.Rows.Count, 1).End(xlUp).Row, 1)
End With
With Workbooks("MasterBook.xls").Sheets("MasterList")
If IsEmpty(.Cells(1, 1).Value) Then
Set rDest = .Cells(1, 1)
Else
Set rDest = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0)
End If
End With
rSource.EntireRow.Copy Destination:=rDest
 
Top