EXCEL vba vLOOKUP

2007-08-16 5:47 am
WHAT 's wrong for below script: Please help to correct

Sub a()
Dim myName As String, mySTR As String, myRow As String
myName = InputBox("Please enter Service ticket no. ")
mySTR = myName
myName = Application.WorksheetFunction.VLookup(mySTR, Sheets(Sheet3).Range("B2:I300"), 8, 0)
MsgBox "The founding is :" & myRow & "。"
End Sub

回答 (2)

2007-08-16 7:30 am
✔ 最佳答案
myRow As String?
Sheets(Sheet3)是錯的, 應寫成 Sheet3. 或 Sheets("Sheet3")
Sub a()
Dim myName As String, mySTR As String
mySTR = InputBox("P lease enter Service ticket no. ")
myName = Application.Workshee tFunction.VLookup(mySTR, Sheet3.Range (“B2:I300”), 8, 0)
MsgBox "The founding is :" & myName & "。"
End Sub
注意: B2:B300的內容一定要是String
2007-08-16 6:25 am
which version of office are you using ?
I am using office XP and i found that i use this to define the sheet

Worksheets("Sheet1").Range .....


收錄日期: 2021-04-18 23:01:38
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070815000051KK06079

檢視 Wayback Machine 備份