2020年12月20日星期日

excel macro Run-time eror '13' Type mismatch

I'm new to excel macros and have tried using Hlookup. When I tried to execute the code it returned the following error: "Unable to get the HLookup property of the WorksheetFunction Class" error Thus I have tried to debug via error handling but am getting this error: excel macro Run-time error '13' Type mismatch. I've realised it is because of conflicting data types, but am unsure how to express If myHLookupResult <> "" Then MsgBox myHLookupResult in a way it can handle looking at the long datatype.

Dim myHLookupResult As Long    On Error Resume Next  myHLookupResult = WorksheetFunction.HLookup(CalcSheet.Range("C81"), CalcSheet, 57)  On Error GoTo 0                            If myHLookupResult <> "" Then MsgBox myHLookupResult                            pmp.Offset(0, 14).Value = myHLookupResult  

Thanks in advance!

https://stackoverflow.com/questions/65386290/excel-macro-run-time-eror-13-type-mismatch December 21, 2020 at 08:52AM

没有评论:

发表评论