如何选择整个excel表在C#Excel.Range对象? [英] How to Select the whole excel sheet in Excel.Range object of c#?

查看:411
本文介绍了如何选择整个excel表在C#Excel.Range对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想选择整个Excel工作表中的CC#的 Excel.Range 对象将自动调整,边框等我有表内的一些合并单元格

I am trying to select the whole excel sheet in the Excel.Range object of cC# for applying auto fit, border etc. I have some merged cells within the sheets.

有没有什么简单的一招这样做呢?

Is there any simple trick to do so?

推荐答案

此处拍摄,这将选择所有单元格在工作表中:

Taken from here, this will select all cells in the worksheet:

lastCol = ActiveSheet.Range("a1").End(xlToRight).Column
lastRow = ActiveSheet.Cells(65536, lastCol).End(xlUp).Row
ActiveSheet.Range("a1", ActiveSheet.Cells(lastRow, lastCol)).Select

这篇关于如何选择整个excel表在C#Excel.Range对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆