我有一个工作簿可以打开另一个工作簿(Envision)。然后我尝试使用动态范围(Drw_Search_Rng)在'Envision'中使用WorkSheet函数CountIf。我一直收到类型不匹配错误。我做错了什么?
Dim EnViSioN As New Excel.Application
'Opens Envision # list
EnViSioN.Workbooks.Open FileName:=FilePath, ReadOnly:=True
'Sets Range to search for drawing #: For eg. EnViSioN.Sheets(1).Range("A1:A26")
Set Drw_Search_Rng = EnViSioN.Sheets(1).Range(ColLett(DrWNum_Col) & "1:" & ColLett(DrWNum_Col) & Envision_LastRow)
'Check how many times DrWNum was found in the Drw_Search_Rng
DrwNum_Hits = Application.WorksheetFunction.CountIf(Drw_Search_Rng, "*" & DrWNum & "*")
谢谢, 马哈茂德