-->

Mac的Excel的2011 VBA UDF不工作 - 设置或查找命令似乎是问题(Mac Excel

2019-10-18 05:25发布

我从Excel 2007中转换电子表格到Mac的Excel 2011年。我已经试过了好几个小时来解决我的问题,都没有成功,所以任何帮助,将不胜感激!

该UDF发现的范围内的字符串,然后返回所找到的小区低于值一个小区。 SET命令返回没有在Mac版本,但在Excel 2007工作。

Function FindRng(Fnd As String)
Application.Volatile

Dim Rng As Range
If Fnd = "" Then
    FindRng = 0
    GoTo 109
End If
With Sheets("Matrix").Range("G2:FZ13")
         Set Rng = .Find(What:=Fnd, _
                After:=.Cells(2, 7), _
                LookIn:=xlValues, _
                LookAt:=xlWhole, _
                SearchOrder:=xlByRows, _
                SearchDirection:=xlNext, _
                MatchCase:=False)
    If Not Rng Is Nothing Then
        FindRng = Sheets("Matrix").Cells(Rng.Row + 1, Rng.Column).Value
    Else
        FindRng = 0
    End If
End With

109 End Function

Answer 1:

找到一个从小区名为UDF在2011年不工作(在PC版本的预Office XP中存在同样的问题),所以你要么必须循环和测试每个单元(将数据加载到一个数组应该比快读取细胞通过细胞)或处理一行在使用application.match例如时间。



文章来源: Mac Excel 2011 VBA UDF not working - SET or FIND command seems to be the issue