pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
Hi,
I am running this code from book1. trying to copy from book1 and then paste it in book2.
Macro3 is to simply copy from region "A3 to F3"
I am getting Runtime error '9'
subcript out of range
Please help!
I understand, I think you guys must be tired of my thread but I would request not to. I need help
Pedie
I am running this code from book1. trying to copy from book1 and then paste it in book2.
Macro3 is to simply copy from region "A3 to F3"
I am getting Runtime error '9'
subcript out of range
Please help!
I understand, I think you guys must be tired of my thread but I would request not to. I need help
Pedie
Code:
Sub Test2()
Dim wb As Workbook, MyFile As String
MyFile = "C:\book2.xls"
On Error Resume Next
Set wb = Workbooks.Open(Filename:=MyFile[COLOR=red], Password:="123"[/COLOR])
On Error GoTo 0
If wb Is Nothing Then MsgBox "Couldn't locate " & MyFile: Exit Sub
call Macro3
With wb
With sheet1
.Range("A3").Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(1, 0).Select
Loop
ActiveSheet.Paste
End With
.Save
.Close
End With
End Sub