0
A
回答
1
0
并不清楚OP实际需要(“不为空”细胞或公式,或者还有什么导致“不为空”细胞)
所以我扔在只是一些例子:
Option Explicit
Sub TicketCopy()
With Worksheets("Formulas")
With .Range("A2", .Cells(.Rows.Count, 1).End(xlUp)) '<--| reference column "A" cells from row 2 to last not empty one
' all cells in range with formulas only
With .SpecialCells(xlCellTypeFormulas)
MsgBox "The Rows Count= " & .Count ' cells number
MsgBox "The Rows Count= " & WorksheetFunction.Count(.Cells) ' cells resulting "not blank" (a 'zero' is a "not blank")
MsgBox "The Rows Count= " & WorksheetFunction.CountIf(.Cells, "") ' cells resulting "blank" (a 'zero' is a "not blank")
MsgBox "The Rows Count= " & WorksheetFunction.CountBlank(.Cells) ' cells resulting "blank" (a 'zero' is a "not blank")
End With
'all cells in range
MsgBox "The Rows Count= " & .Count ' cells number
MsgBox "The Rows Count= " & WorksheetFunction.Count(.Cells) 'cells resulting "not blank" (a 'zero' is a "not blank")
MsgBox "The Rows Count= " & WorksheetFunction.CountIf(.Cells, "") 'cells resulting "blank" (a 'zero' is a "not blank")
MsgBox "The Rows Count= " & WorksheetFunction.CountBlank(.Cells) ' cells resulting "blank" (a 'zero' is a "not blank")
End With
End With
End Sub
相关问题
- 1. 方法范围失败
- 2. Excel的VBA:范围类的复制方法失败
- 3. VBA错误'失败的方法范围'(范围通过变量声明)
- 4. Excel VBA - 对象'工作表'的方法'范围'失败
- 5. 对象_Worksheet Excel的VBA方法范围失败
- 6. Excel VBA“范围级别的自动填充方法失败”
- 7. Excel VBA - 范围类的自动填充方法失败
- 8. 范围类的删除方法失败
- 9. GoalSeek范围类的方法失败
- 10. 范围类的排序方法失败
- 11. 对象'范围'的方法'FormulaR1C1'失败
- 12. 粘贴范围班级特殊方法失败vba
- 13. 对象_worksheet的方法范围失败,命名范围为
- 14. 在Excel中的范围方法VBA
- 15. 运行时错误'1004' - 对象'全局'的方法'范围'在VBA中失败
- 16. VBA Excel范围方法
- 17. 范围类的AutoFilter方法在VB.NET中失败
- 18. 简单的Excel VBA宏:误差范围类的1004方法失败
- 19. VBA运行时错误1004范围类的自动过滤方法失败
- 20. 运行时错误'1004':选择范围类失败的方法VBA
- 21. Excel VBA错误:运行时错误'1004'范围类的选择方法失败
- 22. VBA Excel:运行时错误'1004'object'_Worksheet'的方法'范围'失败
- 23. VBA运行时错误“1004”。范围类的自动过滤方法失败
- 24. 运行时错误'1004':选择范围类失败的方法VBA 2003
- 25. VBA - 选择方法失败
- 26. VBA Validation.Add方法失败
- 27. 引用命名范围时,对象'_Global'的方法'范围'失败错误
- 28. vba方法对象错误的范围
- 29. 类的范围排序失败的方法c# - excel
- 30. PHP函数范围失败
范围不点不参照“公式”工作表 – user3598756
@ user3598756 ** OUCH **!谢谢...........我会修正代码! –
了解,非常感谢! –