如何用vba获得excel表中的总行数,或者总列数???
我做的程序用vba调用excel中的数据,但是遇到一个问题,不知道如何获得excel表中的总列数,或者总行数例子如下:
With excelapp.ActiveWorkbook.Worksheets("~cs5")<BR> For i = 2 To ?????? step 1
pt1(0) = Range("c" & i)<BR> pt1(1) = Range("d" & i)<BR> pt1(2) = Range("e" & i)<BR> ThisDrawing.ModelSpace.AddPoint pt1
Next i
End With<BR>
??????里面我该怎么填啊??给段代码可以吗??? usedrange 做了个试验:
Dim i As Integer<BR> Dim j As Integer<BR> <BR> j = 0<BR> For i = 2 To UsedRange Step 1<BR> <BR> j = j + 1<BR> <BR> Next i<BR> <BR> TextBox2.Text = j
结果返回0,无解哦~~~~~~~问题在哪啊?? for i=2 to Sheets("sheet1").UsedRange.Rows.Count
页:
[1]