I have a table of data in a sheet which I am using to copy a number of select rows in to another workbook. Once I have the rows I convert the data in the destination sheet to a table and give it the same table name as the source, I do the table conversion with -
Dim srcRangeForTbl As Range
Set srcRangeForTbl = wsDestinationSheet.Range("A1").CurrentRegion
wsDestinationSheet.ListObjects.Add(SourceType:=xlSrcRange, Source:=srcRangeForTbl).Name = "AllStaffProjectAllocationTbl"
wsDestinationSheet.ListObjects("AllStaffProjectAllocationTbl").TableStyle = ""
I have the following formula in W2 in the source sheet that then graphs that data from the source table in to a gannt chart.
=IF((AllStaffProjectAllocationTbl[Start Date]<DATE(YEAR(W1:YE1),MONTH(W1:YE1)+1,1))*(AllStaffProjectAllocationTbl[End Date]>=W1:YE1),AllStaffProjectAllocationTbl[Employee],"")
I copy the formula in to the destination sheet with the following code -
SheetSource.Range("W2").Copy
wsDestinationSheet.Range("W2").PasteSpecial Paste:=xlPasteFormulas
Unfortunately this takes the above formula from W2 and adds references to the original workbook as below -
=IF((Project.xlsm!AllStaffProjectAllocationTbl[Start Date]<DATE(YEAR(W1:YE1),MONTH(W1:YE1)+1,1))*(Project.xlsm!AllStaffProjectAllocationTbl[End Date]>=W1:YE1),Project.xlsm!AllStaffProjectAllocationTbl[Employee],"")
Is there a way to exclude these workbook references?