Hi Everybody,
Hopefully a very simple one...........
Below I have some code that allows me to open a workbook elsewhere based on a location (M12) on a Sheet called 'Address'. What I can't figure out is how to then select the Sheet I am after in what would be cell E13 on the sheet address as well. Its currently called and coded as "VAT Return" but the name changes hence why I want to use a cell reference in the code. Is this possible as I cant seem to figure it out.
Dim sourceBook As Workbook
Application.ScreenUpdating = False
Set sourceBook = Workbooks.Open(Sheets("Address").Range("M12").Value)
sourceBook.Sheet.Name("VAT Return").Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
sourceBook.Close
Application.ScreenUpdating = True
Many Thanks
D
Hopefully a very simple one...........
Below I have some code that allows me to open a workbook elsewhere based on a location (M12) on a Sheet called 'Address'. What I can't figure out is how to then select the Sheet I am after in what would be cell E13 on the sheet address as well. Its currently called and coded as "VAT Return" but the name changes hence why I want to use a cell reference in the code. Is this possible as I cant seem to figure it out.
Dim sourceBook As Workbook
Application.ScreenUpdating = False
Set sourceBook = Workbooks.Open(Sheets("Address").Range("M12").Value)
sourceBook.Sheet.Name("VAT Return").Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
sourceBook.Close
Application.ScreenUpdating = True
Many Thanks
D