Hi All,
Kindly help me out i m trying to copythe active sheet in source workbook and poaste it into another book after or before available sheets.
i have used the code but getting the error "run time error 9 subscript out of range."
this is the code
Sub CopySheetToOtherWbk()
Dim CopyFromBook As Workbook
Dim CopyToWbk As Workbook
Dim ShToCopy As Worksheet
Set CopyFromBook = Workbooks("Invoice.xlsm")
Set ShToCopy = CopyFromBook.Worksheets("Invoice")
Set CopyToWbk = Workbooks("D:\Invo\test.xlsx")
'
ShToCopy.Copy After:=CopyToWbk.Sheets(CopyToWbk.Sheets.Count)
End Sub
Bookmarks