VBA错误错误2023

时间:2016-12-02 02:57:37

标签: vba excel-vba vlookup excel

我不知道为什么我在调试时收到此错误!

我有一张表格如下:

table

我正在进行简单的查找,但即使匹配类型,它似乎也不起作用:

这是我的代码

+----------------------+
|John                  |
|May                   |
|Jo                    |
|dy                    |
+--------------------- +

我只是按照一个简单的教程,这是它的完成方式,我搜索了一些解决方案,但似乎没有工作

我得到的是调试窗口中的内容: Sub projectLookUp2() Dim mainWorkBook As Workbook Dim ProjectListSheet As Worksheet Dim newSheet As Worksheet Set mainWorkBook = Workbooks("CPL ERICOLL Uploader final_20161109 (Autosaved).xlsm") 'this is the active workbook Set ProjectListSheet = mainWorkBook.Worksheets("Project List") Set newSheet = mainWorkBook.Worksheets("new sheet") lrow = ProjectListSheet.Cells(Rows.Count, "C").End(xlUp).row Dim projectName As String Dim TGPassed As Variant projectName = "XL M2M Initial Setup" With ProjectListSheet TGPassed = Application.VLookup(projectName, Range("C4:C" & lrow), 2, False) Debug.Print CStr(TGPassed) End With 'Debug.Print ProjectListSheet.Range("D10").Value End Sub

0 个答案:

没有答案