[英]Dynamic range to count empty cells
To define the range for my For
loop i use a Match function to locate the first row containing a specific string.为了定义我的For
循环的范围,我使用 Match function 来定位包含特定字符串的第一行。 This works fine and I would like to combine this with the number of empty cells in that Range using the WorksheetFunction.CountBlank
这很好用,我想使用WorksheetFunction.CountBlank
将它与该范围内的空单元格数结合起来
I set up this code to return the corresponding row:我设置此代码以返回相应的行:
iCounterFilled01 = 0
On Error Resume Next
iCounterFilled01 = Application.WorksheetFunction.Match("Date", wksSource01.Range("A:A"), 0)
On Error GoTo 0
Using this i am trying to return the number of empty cells within this Range使用这个我试图返回这个范围内的空单元格的数量
iEmptyCells01 = WorksheetFunction.CountBlank_
(wksSource01.Range(wksSource01.Cells(1, 1)), wksSource01.Cells(iCounterFilled01, 8))
This however returns the error "incorrect amount of arguments or incorrectly assigned property".然而,这会返回错误“arguments 数量不正确或属性分配不正确”。
Help would be greatly appreciated, thanks帮助将不胜感激,谢谢
You have a misplaced parenthesis before the comma inside the parameter of the CountBlank
, replace this:您在CountBlank
的参数内的逗号之前有一个放错位置的括号,请替换为:
WorksheetFunction.CountBlank(wksSource01.Range(wksSource01.Cells(1, 1)), wksSource01.Cells(iCounterFilled01, 8))
with this有了这个
WorksheetFunction.CountBlank(wksSource01.Range(wksSource01.Cells(1, 1), wksSource01.Cells(iCounterFilled01, 8)))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.