+ Reply to Thread
Results 1 to 3 of 3

DLOOKUP AND VLOOKUP IN VBA

  1. #1
    Souris
    Guest

    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,



  2. #2
    Norman Jones
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    >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,
    >
    >




  3. #3
    Roy Wagner
    Guest

    RE: 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,
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1