Hello,
I’m using the code,
to copy a worksheet to a new workbook. What is happening is the path to the Master workbook is adding itself to each of the formulas.
Example;
=IF(ISERROR(INDEX('C:\Users\Michael''s\Desktop\[Master.xls]Data'!$U$2:$U$2000,MATCH(--'Team Calendar'!A6,'C:\Users\Michael''s\Desktop\[Master.xls]Data'!$F$2:$F$2000,0),0)),"",INDEX('C:\Users\Michael''s\Desktop\[Master.xls]Data'!$U$2:$U$2000,MATCH(--'Team Calendar'!A6,'C:\Users\Michael''s\Desktop\[Master.xls]Data'!$F$2:$F$2000,0),0))
I thought I could run a code to remove the path at the end but didn't have any luck. I was using.
I get an application error on this line.
any help is appreciated.
I’m using the code,
Code:
Workbooks(mydatafile).Sheets("team calendar").Copy _
after:=Workbooks(TEMPFILE).Sheets("Sheet1")
to copy a worksheet to a new workbook. What is happening is the path to the Master workbook is adding itself to each of the formulas.
Example;
=IF(ISERROR(INDEX('C:\Users\Michael''s\Desktop\[Master.xls]Data'!$U$2:$U$2000,MATCH(--'Team Calendar'!A6,'C:\Users\Michael''s\Desktop\[Master.xls]Data'!$F$2:$F$2000,0),0)),"",INDEX('C:\Users\Michael''s\Desktop\[Master.xls]Data'!$U$2:$U$2000,MATCH(--'Team Calendar'!A6,'C:\Users\Michael''s\Desktop\[Master.xls]Data'!$F$2:$F$2000,0),0))
I thought I could run a code to remove the path at the end but didn't have any luck. I was using.
Code:
Dim cell As Range, n As Variant
For Each cell In Workbooks("tempfile").Sheets("team calendar").Cells.SpecialCells(xlFormulas)
n = Application.Find("]", cell.Formula)
If Not IsError(n) Then
cell.Formula = "='" & Right(cell.Formula, Len(cell.Formula) - n)
End If
Next cell
I get an application error on this line.
Code:
cell.Formula = "='" & Right(cell.Formula, Len(cell.Formula) - n)
any help is appreciated.