本帖最後由 bongbong3481 於 2016-2-28 00:36 編輯
我有個EXCEL 表, 由A1:A15000 都系等於1,我用count(A1:A15000), 1,2秒就出到答案,但如果用以下VBS CODE 去COUNT, 等成1分鐘先出到答案,有冇人知道點解咁慢呢?   
strFileName = "C:\Documents and Settings\KK\桌面\speed.xls"
Set oExcel = CreateObject("Excel.Application")
oExcel.visible = true
set osheet= oExcel.Workbooks.Open(strFileName)
lastrow=osheet.sheets("sheet1").Range("A1").CurrentRegion.Rows.Count
C=0
for N=1 to lastrow
if osheet.worksheets("sheet1").cells(N,1).value<>"" then
C=C+1
end if
next
msgbox "C=" & C |