Hi All,
Im trying to copy a data from 1st excel to 2nd excel. While im about to select a sheet in 2nd file im getting "Subscript out of range" as error. I have used the same code earlier for several other excels but I haven't get this kind of error. Can someone help me to fix this. Below is my code.
Im getting error exactly here "Sheets("Addition").Select"
Im trying to copy a data from 1st excel to 2nd excel. While im about to select a sheet in 2nd file im getting "Subscript out of range" as error. I have used the same code earlier for several other excels but I haven't get this kind of error. Can someone help me to fix this. Below is my code.
Im getting error exactly here "Sheets("Addition").Select"
Code:
Sub Template()
Application.ScreenUpdating = False
Dim twb As Workbook
Dim tw As ThisWorkbook
Set tw = ThisWorkbook
Sheet3.Select
Range("F10").Select
TempSBU = Selection.Value
Workbooks.Open Filename:=TempSBU
Set twb = ActiveWorkbook
tw.Activate
Sheet4.Select
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
twb.Activate
Sheets("Addition").Select