View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
marcus[_3_] marcus[_3_] is offline
external usenet poster
 
Posts: 140
Default Copy Active Range from one workbook to another

Hi Jatman

This uses the Autofilter to copy the cells with data in Column A over
to another workbook and places them at the bottom of the used range in
this workbook. Change to suit.

Take care

Marcus

Option Explicit

Sub test()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim lw As Integer
Dim lr As Integer

Set wb1 = ActiveWorkbook
Set wb2 = Workbooks("BOOK3")'Change to your workbook name
lr = Range("A" & Rows.Count).End(xlUp).Row
lw = wb2.Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row

Columns(1).AutoFilter Field:=1, Criteria1:="<"
Range(Cells(2, 1), Cells(lr, 2)).Copy wb2.Sheets("Sheet1").Range("A" &
lw)

End Sub