几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   数据库ObjectDBX (http://www.dimcax.com/hust/forumdisplay.php?f=177)
-   -   【转帖】如何用vba获得excel表中的总行数,或者总列数??? (http://www.dimcax.com/hust/showthread.php?t=8564)

yang686526 2009-04-19 06:42 PM

【转帖】如何用vba获得excel表中的总行数,或者总列数???
 
如何用vba获得excel表中的总行数,或者总列数???
www.dimcax.com
如何用vba获得excel表中的总行数,或者总列数???
我做的程序用vba调用excel中的数据,但是遇到一个问题,不知道如何获得excel表中的总列数,或者总行数
例子如下:
with excelapp.activeworkbook.worksheets("~cs5")
for i = 2 to ?????? step 1
pt1(0) = range("c" & i)
pt1(1) = range("d" & i)
pt1(2) = range("e" & i)
thisdrawing.modelspace.addpoint pt1
next i
end with
??????里面我该怎么填啊??给段代码可以吗???
usedrange
做了个试验:
dim i as integer
dim j as integer

j = 0
for i = 2 to usedrange step 1

j = j + 1

next i

textbox2.text = j
结果返回0,无解哦~~~~~~~问题在哪啊??
for i=2 to sheets("sheet1").usedrange.rows.count


所有的时间均为北京时间。 现在的时间是 04:39 AM.