I get the error message "object required" for line
If Not wbk Is Nothing Then
Jim Thomlinson wrote:
Try this...
For Each rw In Range("block1")
x = rw
If rw = 0 Then GoTo endmacro
on error resume next
Set wkb = Workbooks.Open(rw.Offset(0, 1).value & "\" & _
rw.value, Notify:=False)
on error goto 0
if not wbk is nothing then
Application.Goto Reference:="interestinput"
Selection.Copy
Windows("US Bank Statement Interest multiple months.xls").Activate
Selection.PasteSpecial Paste:=xlPasteValues
Windows(x).Activate
Range("b6").Copy
Windows("US Bank Statement Interest multiple months.xls").Activate
Range("e2").End(xlDown).Offset(0, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues
Selection.End(xlUp).Select
Selection.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues
Range(Selection, Selection.End(xlDown)).Select
Selection.FillDown
Range("b2").End(xlDown).Offset(1, 0).Select
Application.CutCopyMode = False
wkb.Close savechanges:=False
set wbk = nothing
end if
Next rw
endmacro:
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Range("a2").Select
End Sub
everything works great except when the file does not exist the macro still
does the Windows(x) activate, range("b6").copy when in fact Windows(x) does
[quoted text clipped - 51 lines]
Range("a2").Select
End Sub
--
Message posted via
http://www.officekb.com