Hi Melba,
Ok, I've isolated the incident to 2 formula based columns, which are nearly identical.
In the test file, there are 2 columns: Q & V. These 2 columns contain a formula that reads:
=IF(P1<=3,"Y","N")
When I try to copy these 2 columns using the "CopyTo" method, my application crashes. However, if I switch the string data to numeric, it works fine:
=IF(P1<=3,0,1)
So the error seems to involve an issue with reading string data in a formula.
Here's the code I'm using:
-----------------------------------------------
sheet1 = workbook.Worksheets[2];
sheet2 = workbook.Worksheets[3];
sheet3 = workbook.Worksheets[4];
sheet4 = workbook.Worksheets[5];
sheet5 = workbook.Worksheets[6];
sheet6 = workbook.Worksheets[7];
newSheet = workbook.Worksheets[8];
//1st sheet
sheet1.Range[1,1,1,22].CopyTo(newSheet.Range[1, 1]);
workbook.ActiveSheetIndex = 8;
----------------------------------------------
So, using this code, the application will crash on columns 17 & 22 (columns Q & V). If you set the range to "[1, 1, 1, 16]", it works fine.
Any idea how I can work around this?
Thanks again.
-Ryan
TestFile.zip