pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
Hi Everyone!
My code is working perfect i guess for now but I have to make sure things are placed accordingly like error handling etc....as i dont want problem to occur latter.
Thanks again!
Pedie
My code is working perfect i guess for now but I have to make sure things are placed accordingly like error handling etc....as i dont want problem to occur latter.
Thanks again!
Pedie

Code:
Sub try12()
Application.ScreenUpdating = False
Dim wb As Workbook, MyFile As String
Dim sh As String
sh = Sheet1.Range("B1").Value
MyFile = "D:\Book2.xlsm"
On Error Resume Next
Set wb = Workbooks.Open(Filename:=MyFile, Password:="trytry")
On Error GoTo 0
If wb Is Nothing Then MsgBox "Error.....": Exit Sub
Windows("Book2.xlsm").Activate
[COLOR=blue]On Error GoTo ErrHandl[/COLOR]
Worksheets(sh).Visible = xlSheetVisible
ActiveSheet.Activate
Sheet1.Range("A51:K51").Copy
Windows("Book2.xlsm").Activate
Range("A1").Select
ActiveSheet.Paste
Worksheets(sh).Visible = xlSheetVeryHidden
wb.Close savechanges:=True
Application.CutCopyMode = False
ActiveSheet.Range("A3").Select
MsgBox "Done"
[COLOR=blue] Exit Sub[/COLOR]
[COLOR=blue]ErrHandl:[/COLOR]
[COLOR=blue] MsgBox "Neee", vbInformation[/COLOR]
[COLOR=blue]wb.Close savechanges:=False[/COLOR]
Application.ScreenUpdating = True
End Sub
Last edited: