I'm identifying a target file and then copying a tab from that into the workbook. This works fine.
I then want to rename that tab according to a cell value in the target file and this is where I am failing. Hopefully it's an easy/obvious syntax or similar problem as I haven't touch VB for years.
Thanks for your help - this is what I have and I get an error on the last line:
Sub Import() TargetFile = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls), *.xls", Title:="Please select the file for import") If TargetFile = False Then 'They pressed Cancel MsgBox "Import cancelled" Exit Sub Else Workbooks.Open Filename:=TargetFile End If Sheets("DATA").Select Sheets("DATA").Copy After:=Workbooks("Master dB.xlsm").Sheets("dB") Sheets("DATA").Name = Workbooks(TargetFile).Sheets("Inputs general").Cell("C6").Value