Excel 2016 UDF未显示

时间:2018-10-26 22:35:31

标签: vba user-defined-functions excel-2016

我一直在从Excel for Business网站上学习一些VBA课程,并创建了一个用户定义的函数ULookup。该函数在电子表格中可以正常工作,如果我使用=符号,则会显示Ulookup。但是,Control-Shift-A不会像在PC上那样显示完整的填写提示,并且如果我转到插入功能菜单,该功能将根本不会显示。这是Mac版本的Excel中的错误,还是我缺少什么?这是我在myWorkbook的模块1中输入的代码:

Option Base 1

Function ULookup(lookup_value As Range, lookup_range As Range, source_range As Range, Optional match_type As Integer = 0) As Variant()
' Performs an Index / Match Lookup.
Dim results_Array() As Variant
Dim lookup_index As Long
ReDim results_Array(1) As Variant

' Consider defining this as an array function

' Dim lookup_value ' Contains the value I want to find

' Dim lookup_range ' Range to search in

' Dim source_range ' Pull corresponding value from

' Dim match_type   ' Consider the type of match to perform, exact, lesser, greater


' Find lookup_value in lookup range
lookup_index = Application.WorksheetFunction.Match(lookup_value, lookup_range, match_type)


' Determine if lookup value was in the range.

' Get corresponding value from source range
results_Array(1) = WorksheetFunction.Index(source_range, lookup_index)

' Do not edit code beyond this comment
ULookup = results_Array

End Function

0 个答案:

没有答案