【发布时间】:2021-01-28 19:44:59
【问题描述】:
我已将单元格“U7”设置为“HV7”。 此范围的目的是计算其中的值。
当前代码正在运行,但我想通过选择最后一个值来避免超出 HV 列的值的可能性。
Dim countRange As Range
Set countRange = Range("U7:HV7")
Dim rowcount As Long
rowcount = Application.WorksheetFunction.CountA(countRange)
【问题讨论】:
-
您是否希望在计数中包含超出 HV 的值(如果存在)?如果是这样,请尝试
Set countRange = Range("U7", Cells(7, Columns.Count).End(xlToLeft)) -
@SuperSymmetry 这正是我想做的,只是不知道如何设置。