比如要获取选区内可见的非空单元格求和,该如何设计? 我现在是 For Each rng In Selection.SpecialCells(xlCellTypeConstants, xlNumbers) ,然后再对每一个rng判断 entirerow.Hidden or entirecolumn.Hidden 确定单元格的可见性,有没有办法更简便些?
谢谢提醒,脑子抽了一个个去加起来,那样遇到整行整列选取的确费劲,直接sum的话就没问题了 If Selection.Count = 1 Then If IsNumeric(Selection.Value) Then CopyToClipbox Selection.Value Else CopyToClipbox Application.WorksheetFunction.Sum(Selection.SpecialCells(xlCellTypeVisible)) End If