簡體   English   中英

Excel VBA使用范圍選擇整個工作表

[英]Excel VBA select entire sheet using Range

我正在使用以下代碼在工作表中進行搜索,以查找單詞“ example”出現了多少次。

count = Application.WorksheetFunction.CountIf(Range("A1:A10"), "example")

我似乎無法弄清楚如何使用Range函數遍歷整個工作表。

為什么需要遍歷整個工作表? 您可以更改范圍嗎?

A1:A10

count = Application.WorksheetFunction.CountIf(Range("A1:A10"), "example")

A1:E10

count = Application.WorksheetFunction.CountIf(Range("A1:E10"), "example")

整張紙

count = Application.WorksheetFunction.CountIf(ActiveSheet.Cells, "example")  

嘗試在下面查找整個工作表中的字符串“ example”。

Count = Application.WorksheetFunction.CountIf(Cells, "example")

使用通配符

Count = Application.WorksheetFunction.CountIf(Cells, "*example*")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM