Excel 2007 Using vlookup function in VBA
Solved/Closed
gsyrill
gsyrill - Oct 15, 2014 at 04:32 AM
- Posts
- 1
- Registration date
- Saturday October 11, 2014
- Status
- Member
- Last seen
- October 11, 2014
gsyrill - Oct 15, 2014 at 04:32 AM
Related:
- Excel 2007 Using vlookup function in VBA
- Search function in VBA/Excel - How-To - Excel
- Find function in vba excel - Guide
- Excel 2007 IF function ✓ - Forum - Excel
- MS Excel 2007 - Quick Function Question ✓ - Forum - Excel
- Excel 2007 VLOOKUP and MATCH problem ✓ - Forum - Excel
2 replies
TrowaD
Oct 14, 2014 at 11:34 AM
- Posts
- 2886
- Registration date
- Sunday September 12, 2010
- Status
- Moderator
- Last seen
- June 27, 2022
Oct 14, 2014 at 11:34 AM
Hi Gsyrill,
Place the following code in Sheet2:
Now type a number in A1 of sheet2 and check if it works.
Best regards,
Trowa
Place the following code in Sheet2:
Private Sub Worksheet_Change(ByVal Target As Range) Dim fValue As Range If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub Set fValue = Sheets("Sheet1").Columns(1).Find(Target) If fValue Is Nothing Then MsgBox "Value not found." Target.Offset(0, 1).ClearContents Exit Sub Else Target.Offset(0, 1) = fValue.Offset(0, 1) End If End Sub
Now type a number in A1 of sheet2 and check if it works.
Best regards,
Trowa