![]() |
DLOOKUP AND VLOOKUP IN VBA
I wanted to search a value in my spreadsheet using VBA.
I tried to use VLOOKUP and DLOOKUP, but I got compile error "sub or function not defined" The code is like following code iStudent = DLOOKUP("[FIRST SEMI]", "NPARAMETER", "[SHEET NAME]" = "STUDENT NUMBER") iStudent = VLookup("STUDENT NUMBER", "NPARAMETER", False) Are there any other way to search a value from spreadsheet and return a value from other column? Any infromation is great appreciated, |
DLOOKUP AND VLOOKUP IN VBA
Hi Souris,
VLookup is an Excel worksheet function. To use it in VBA try: iStudent = Application,VLookup(...............) or iStudent= Application.WorksheetFunction.VLookup(............ ...) Many, but not all, worksheet functions are available to VBA. See WorksheetFunction in VBA help. For a list of functiona available to VBA, see: 'List of Worksheet Functions Available to Visual Basic' in VBA help. --- Regards, Norman "Souris" wrote in message ... I wanted to search a value in my spreadsheet using VBA. I tried to use VLOOKUP and DLOOKUP, but I got compile error "sub or function not defined" The code is like following code iStudent = DLOOKUP("[FIRST SEMI]", "NPARAMETER", "[SHEET NAME]" = "STUDENT NUMBER") iStudent = VLookup("STUDENT NUMBER", "NPARAMETER", False) Are there any other way to search a value from spreadsheet and return a value from other column? Any infromation is great appreciated, |
DLOOKUP AND VLOOKUP IN VBA
In the VB Editor, bring up HELP, then search for the WorksheetFunction Object.
Set myRange = Worksheets("Sheet1").Range("A1:C10") answer = Application.WorksheetFunction.Min(myRange) MsgBox answer Roy "Souris" wrote: I wanted to search a value in my spreadsheet using VBA. I tried to use VLOOKUP and DLOOKUP, but I got compile error "sub or function not defined" The code is like following code iStudent = DLOOKUP("[FIRST SEMI]", "NPARAMETER", "[SHEET NAME]" = "STUDENT NUMBER") iStudent = VLookup("STUDENT NUMBER", "NPARAMETER", False) Are there any other way to search a value from spreadsheet and return a value from other column? Any infromation is great appreciated, |
All times are GMT +1. The time now is 05:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com