Excel文件的行和列

可以编写一个代码,用NUMBERS和NOT LIKE(B2:D6)来指定电子表格的行和列,

例:

excelSheet.Range("B2:D6").Interior.Color = RGB(100, 100, 255) 

而不是B2和D6我想写5行和3列..

在vb.net 2003代码中写入是可行的吗?

这是C#而不是VB,但是这不应该太难转换:

 var firstCell = (Excel.Range)sheet.Cells[3, 3]; var secondCell = (Excel.Range)sheet.Cells[5, 7]; var cells = sheet.get_Range(firstCell, secondCell); 

只需使用Cells()而不是Range()

 excelSheet.Cells(5,3).Interior.Color = RGB(100, 100, 255)