VBA脚本424:Selection.row.count上需要的对象

时间:2015-07-13 17:15:35

标签: excel-vba vba excel

Option Explicit

Public Sub Testrun()

Dim l As Long

l = Selection.Row.Count
ActiveCell.Value = l


End Sub

此代码显示424错误:VBA中需要对象。请帮忙。

1 个答案:

答案 0 :(得分:1)

使用代替行

Option Explicit

Public Sub Testrun()

Dim l As Long

l = Selection.Rows.Count

ActiveCell.Value = l


End Sub