說明:
1第乙個sheet名為sheet1,第二個名為step
2兩個sheet相比較,如果相同,將檔案個數放到sheet1的第二列
sub countstep()
'' countstep macro
'' keyboard shortcut: ctrl+shift+t
dim sheetycnt as integer
dim stepycnt as integer
dim sheetname as string
dim stepname as string
sheetname = "sheet1" 'result page name
stepname = "step" 'result from page name
sheetycnt = worksheets(sheetname).usedrange.rows.count
stepycnt = worksheets(stepname).usedrange.rows.count
for i = 1 to sheetycnt
dim filename as string
' read column 1 of result page
filename = worksheets(sheetname).cells(i, 1).value
dim k as integer
k = 0
for j = 1 to stepycnt
dim fullname as string
dim lastword as string
dim index as integer
fullname = worksheets(stepname).cells(j, 1).value ' read column 1 of result from page
'substr string from last '\' to end
index = instrrev(fullname, "\")
lastword = mid(fullname, index + 1)
if filename = lastword then
k = k + 1
' column 5 (result from page )-> column 1 (result page)
worksheets(sheetname).cells(i, 2).value = k
end if
next
next
msgbox "end"
end sub
統計檔案中單詞個數
狀態機基本適合所有的遊戲專案,做做雜兵啦,做做boss啦,做做選單啦啥的。當它有超過兩個狀態,就可以去考慮做個狀態機了 要不還是if方便 這樣在工程迭代的時候很容易加入新的更新。include include include define init word 0 初始化單詞,預編譯時被替換 defi...
fgetc統計檔案的字元個數
getc 函式和fgetc 函式是從乙個指定的流中讀取乙個字元,getchar 函式是從stdin中讀取乙個字元。函式putc fputc putchar 需要標頭檔案 include 函式原型 int putc int c,file stream int fputc int c,file stre...
Ubuntu 統計檔案個數的命令
1 統計當前資料夾內檔案數量且包含子目錄中的檔案數量,命令如下 ls lr grep wc l2 統計當前資料夾內檔案數量且不包含子目錄檔案數量,命令如下 ls l grep wc l3 統計當前資料夾下的目錄個數且包含子目錄 ls lr grep d wc l4 統計當前資料夾下的目錄個數 ls ...