Thread: Compile error
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim May Jim May is offline
external usenet poster
 
Posts: 430
Default Compile error

I'm wanting to Copy some auto-filtered data to
worksheets("POReqsSent") and to
worksheets("POReqsHistoy") << of the same current Workbook
PLUS I ant to copy it to a Closed Workbook
on the same drive
workbbook("POs-ExecDir.xls").Worksheets("POReqsIncoming").Range(" A2")

Right now my code referring to the closed workbook is (above mention and
below stated Is BOMBING!!
Can some one assist?


.... Code before...
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With
If rng2 Is Nothing Then
MsgBox "No Data found to copy"
Exit Sub
Else
Set rng1 = ActiveSheet.AutoFilter.Range
rng1.Offset(1, 0).Resize(rng1.Rows.Count - 1).Copy _
Destination:=Worksheets("POReqsSent").Range("A2")
rng1.Offset(1, 0).Resize(rng1.Rows.Count - 1).Copy _
Destination:=Worksheets("POReqsHistory").Range("A2 ")
rng1.Offset(1, 0).Resize(rng1.Rows.Count - 1).Copy _
Destination:="\\MyPc1\Shareddocs\\POs-ExecDir.xls\Worksheets("POReqsIncoming").Range("A2 ")"
End If
rng2.EntireRow.Delete
.... code following...