在下面的代碼中,我有錯誤,因爲索引超出了數組的範圍。即使這樣做代碼複製細胞注入柱正確..沒有任何一個幫助我在此索引超出了C#數組的範圍可以任何讓我知道我在哪裏犯了錯誤
string[] array = { "F3", "J3", "N3", "R3", "V3", "Z3", "AD3", "AH3", "AL3", "AP3" };
string[] arrayb={"C","G","K","O","S","W","AA","AE","AI","AM"};
int a1count = arrayb.Length;
int b = 0;
for (int a=0; a<= a1count; a++)
{
Excel.Range sourceRange = xlWorkSheet.get_Range(array[a]);
Excel.Range destinationRange = xlWorkSheet.UsedRange.Columns[arrayb[b]];
sourceRange.Copy(Type.Missing);
destinationRange.PasteSpecial(Microsoft.Office.Interop.Excel.XlPasteType.xlPasteFormulas,
Microsoft.Office.Interop.Excel.XlPasteSpecialOperation.xlPasteSpecialOperationNone, false, false);
b++;
}
你至少可以*嘗試*很好地格式化你的代碼。 – 2013-03-01 05:56:23
[Index的可能重複超出了數組的範圍 - 整數](http://stackoverflow.com/questions/13221309/index-was-outside-the-bounds-of-the-array-integers) – ChrisF 2013-03-01 11:43:16