Home > Software engineering >  About can't get the kind of WorksheetFunction VLookup attribute in VBA
About can't get the kind of WorksheetFunction VLookup attribute in VBA

Time:11-12

Sub chaxun ()

Sheet1. Range (" d14 ")=Application. WorksheetFunction. VLookup (Sheet1. Range (" d9 "), Sheet2. Range (" a: h "), 5, 0)

End Sub


Don't know how to solve, the great god gives directions!!!!!! Thank you very much ~ ~ ~

CodePudding user response:

Haven't met, help you to baidu:
https://www.baidu.com/s? Wd E8 8 d B8 E4=% % % % % 83% % BD E5 E5 8 f % 96% % % BE E7 BBworksheetfunction B1 E7 % % % % % 97% 9 a 84 B1 E5 vlookup % % % % 9 e % E6%80% A7 & amp; Ie=utf-8

CodePudding user response:

Vlookup found no value will be an error, the front to find data not correct

After On the Error Resume Next statement fault tolerance, tolerance to variable to zero

CodePudding user response:

You check you want to search the value Sheet1, Range (" d14 "), is in your sheet2 a: h column, if this value is in your table 2 in other tables, and will be an error

CodePudding user response:

Lc=Application. WorksheetFunction. VLookup (Sheet1. Range (" d9 "), Sheet2. Range (a: "h"), 5, 0)
If lc> 0 then Sheet1. Range (" d14 ")=lc
  •  Tags:  
  • VBA
  • Related