How to invoke VLookUp function in Excel VBA.
Closed
Wingie
-
Mar 15, 2016 at 05:19 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen January 16, 2023 - Mar 15, 2016 at 12:21 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen January 16, 2023 - Mar 15, 2016 at 12:21 PM
Related:
- How to invoke VLookUp function in Excel VBA.
- How to enable vba in excel - Guide
- Number to words in excel without vba - Guide
- How to change date format in excel - Guide
- Compare two worksheets and paste differences to another sheet - excel vba free download ✓ - Excel Forum
- How to convert number into text in Excel ✓ - Excel Forum
1 reply
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
January 16, 2023
544
Mar 15, 2016 at 12:21 PM
Mar 15, 2016 at 12:21 PM
Hi Wingie,
When the matrix is located in sheet 2 A1:B5, the value to look up is in sheet1 A1 and the result in sheet1 B1, then the code will look like this:
Best regards,
Trowa
When the matrix is located in sheet 2 A1:B5, the value to look up is in sheet1 A1 and the result in sheet1 B1, then the code will look like this:
Sub RunMe() Sheets("Sheet1").Range("B1").Value = Application.WorksheetFunction. _ VLookup(Sheets("Sheet1").Range("A1"), Sheets("Sheet2").Range("A1:B5"), 2) End Sub
Best regards,
Trowa