0

Excelシートでフィルタリングされた行数を取得しようとしていますが、以下のエラーを試しています:

Range クラスの SpecialCells プロパティを取得できません。

strPath="C:\Users\PSin\Desk\CodeInven.xlsx"

Dim ObjectName


ObjectName=Trim(InputBox("Object Name:"))
Set objExcel= CreateObject("Excel.Application")
objExcel.Visible= True

objExcel.Workbooks.Open(strPath)

With objExcel.Activeworkbook.Sheets("All")

    .Range("A1").AutoFilter 19,"="&ObjectName

Rowz = .AutoFilter.Range.Columns(1).SpecialCells(xlCellTypeVisible).Cells.Count - 1 'Not able to figure out the correct way

msgbox Rows


End With
4

1 に答える 1