Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
对象没有';不支持EXCEL VBA中的此属性_Vba_Excel_Excel 2013 - Fatal编程技术网

对象没有';不支持EXCEL VBA中的此属性

对象没有';不支持EXCEL VBA中的此属性,vba,excel,excel-2013,Vba,Excel,Excel 2013,我知道这个错误是什么,但我不明白为什么要调用它。我把纸条放在光标上,它似乎在lin 6[Title=Application….]上断裂了。那我的代码在VBA中不受支持呢 Function Term_gen() TermRow = 3 \\Starting Row on Term Tab ResultsRow = 3 'Starting Row on Results tab Do Until IsEmpty(Worksheets("Results").Ran

我知道这个错误是什么,但我不明白为什么要调用它。我把纸条放在光标上,它似乎在lin 6[Title=Application….]上断裂了。那我的代码在VBA中不受支持呢

Function Term_gen()
    TermRow = 3    \\Starting Row on Term Tab    
    ResultsRow = 3  'Starting Row on Results tab
    Do Until IsEmpty(Worksheets("Results").Range("A:A").Value) 'Loop through a column in "Results" tab until cells are blank

        Do Until IsEmpty(Worksheets("Terms").Range("N:N").Value) 'Loop through column in "Terms" tab until cells are blank


            Lefty = Left(Worksheets("Terms").Range("N" & TermRow).Value, 6) 'Take left 6 letters in the designated cell
            Location = Application.WorksheetFunction.Match(Lefty, Worksheets("Results").Range("ResultsRow:ResultsRow"), 0) 'Use the match function to find the location of the string found in  Lefty, in the row designated    

        If Location IsError Then 'If the tern Row produces an error

            TermRow =  TermRow + 1  'Go to the next Row in Terms and reset loop
        Else

                    Title = Application.WorksheetFunction.Index(Worksheets("Results").Range("A1:CR200000"), Location, ResultsRow) 'Store the value of the term found in the row 
        Loop 'End the loop

        whole_name = Title & Worksheets("Results").Range("X1").Value 'Concatinate the Title Value with a fixed value in spreadsheet

    If whole_name IsError Then 'If the Vlookup Produces an error
            TermRow = TermRow + 1 'Go to next row in Terms and reset loop
    Else

                 term = Application.WorksheetFunction.VLookup(whole_name, Worksheets("Terms").Range("N:O"), 2, 1) 'Vlookup of the whole term in the term sheet

                 Worksheets("Test_Sheet").Range("A" & ResultsRow).Value = term 'Print Term in designated cell


                 ResultsRow = ResultsRow + 1 'Go to next row. Start loop over.

Loop
End Function

您正在传递到Match
Application.WorksheetFunction.Left(工作表(“术语”)、Range(“N:N”).Value的第一个参数,6)
,该参数无效。你期望这是什么?在Excel中,公式将按如下方式打印:{=MATCH(LEFT(Terms!N3,6),Results!3:3)}我正在检查“Terms”选项卡中N列的前6个字母,并在Results选项卡中找到匹配的列。我只是更新了行,认为它可以工作,但没有。Application.WorksheetFunction.Left(工作表(“术语”).Range(“N”和Row”).Value,6)解决这个问题的一个更简单的方法是一次执行一个函数并将结果存储在变量中,而不是将函数嵌套在其他函数中。一旦知道哪个函数实际导致了该函数,就可以对其进行寻址。
Left
作为
WorksheetFunction
的方法不可用(错误所指的“对象”是
WorksheetFunction
)。不要使用
Application.WorksheetFunction.Left
,只需使用
Left
。还有一点,不要为位置行和标题行中的
.Value
而烦恼,只需将它们保留(如果它们保留在标题行中,则会出现内存不足错误)