C# 随笔
1.Range.End属性
1 //示例 2 mysheet.Cells[5, 5].Value = mysheet.Range["G65536"].End[Excel.XlDirection.xlUp].Row;
2. 字典相关
1 //定义 2 Dictionary<string, string> Blocksheet = new Dictionary<string, string>(); 3 4 //遍历 5 foreach(string a in Blocksheet.Keys) 6 { 7 tablesheets[i]=Globals.ThisAddIn.Application.Worksheets[a]; 8 i = i + 1; 9 }
3. Sheet表数组定义
1 //定义 2 Excel.Worksheet[] tablesheets = new Excel.Worksheet[3];
4. 插入行列
1 //插入Range,往左移或者往下移 2 Range.Insert(Excel.XlInsertShiftDirection.xlShiftToRight);
5.得到最后一个单元格
1 tablesheets[i].UsedRange.Cells[tablesheets[i].UsedRange.Count]