我有以下代碼:VLOOKUP,EXCEL,錯誤438「對象不支持此屬性或方法」
- 它應該進入一個名爲「閃電俠」片,並獲得第i個2位數字值,並檢索活動單元右側偏移4列中的值。
- 然後交換到同一工作簿中名爲「Sheet1」的工作表,並使用垂直查找功能查找檢索值並將該值返回到該單元右側的4列。
但是當我運行它下面的腳本停止工作在:
MsgBox (ActiveSheet.VLookup(LookFor, "A:A", 4, True))
和VBA拋出error 438 object doesn't support this property or method
沒有人知道爲什麼有一個例外?
' Begin lookup :
Dim i As Integer, designator As String, LookFor As String
Flash.Activate
ActiveSheet.Range("C3").Select
For i = 3 To lastUsedCellInRow("C")
designator = "C" + CStr(i)
Dim cellVal As String
cellVal = ActiveSheet.Range(designator).Value()
If (Len(cellVal) <= 2 And IsNumeric(cellVal)) Then
LookFor = ActiveSheet.Range(designator).Offset(0, 4).Value()
RawData.Activate
MsgBox (ActiveSheet.VLookup(LookFor, "A:A", 4, True))
End If
Next i
'activesheet.worksheetfunction.vlookup' – 2012-02-12 00:04:45
@TomIngram嗯...這聽起來像它可以工作,但是當我代替我的方法與它仍返回'438'錯誤... – franklin 2012-02-12 00:20:39
嘗試'Application.WorksheetFunction .V Lookup' – Cutter 2012-02-12 01:10:54