Venkat Anvekar
New Member
- Joined
- Mar 22, 2011
- Messages
- 12
Dear Sirs.
I am trying to copy a sheet from one workbook to another using the following code.
A few days back the same code worked but now it is giving an error" subscript out of range" on the copy after statement.
Sheets("MS").Select
PathName1 = Range("v2").Value
pathname2 = Range("P8").Value
pathname3 = Range("u8").Value
filename1 = Range("v6").Value
ControlFile = ActiveWorkbook.Name
Workbooks.Open Filename:=PathName1 & pathname2 & "\" & pathname3 & "\" & filename1
ActiveSheet.Name = "MS"
Worksheets("MS").Copy After:=Workbooks(filename1).Worksheets(1)
Kinldy give your suggestions pls.
Thanks & regards
Venkat
I am trying to copy a sheet from one workbook to another using the following code.
A few days back the same code worked but now it is giving an error" subscript out of range" on the copy after statement.
Sheets("MS").Select
PathName1 = Range("v2").Value
pathname2 = Range("P8").Value
pathname3 = Range("u8").Value
filename1 = Range("v6").Value
ControlFile = ActiveWorkbook.Name
Workbooks.Open Filename:=PathName1 & pathname2 & "\" & pathname3 & "\" & filename1
ActiveSheet.Name = "MS"
Worksheets("MS").Copy After:=Workbooks(filename1).Worksheets(1)
Kinldy give your suggestions pls.
Thanks & regards
Venkat