I am a bit confused on how to properly do a vlookup in VBA within a module.
I want to take the value a cell
Range("G6").Value
and compare it to a range on sheet2
A6:J2000
if it finds a match in column 1 and column 10 = true then display a message box.
Update here is the code I have tried.
Dim sRes As String
sRes = Application.VLookup(G6, Sheet2.Range("A6:J2000"), 2)
MsgBox sRes
ok I figure it out. Here is the working code:
Dim sRes As String
celllookup = Range("R6").Value
sRes = Application.VLookup(celllookup, Sheet5.Range("A6:J2000"), 10, False)
If sResult = "TRUE" Then
MsgBox "Its True"
End If
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.