+ Reply to Thread
Results 1 to 3 of 3

look up syntax

  1. #1
    Pierre
    Guest

    look up syntax

    Hi all,

    I made a small form to enter data in an excel sheet

    Before accepting each record, i want to validate a code number

    If the code exist in a simple colum on an other sheet name lookup i will
    add the data
    otherwise i will beep to make a warning.

    if i write

    If VLookup(tmp, "lookup!a1:a980", 2) Then
    MsgBox "found!"
    Else
    beep
    End If

    vba tell me vlookup does not exist ???
    the sheet llok up is like
    a1 b1
    code1 1
    code2 1
    code3 1

    Help

    Pierre



  2. #2
    Tom Ogilvy
    Guest

    Re: look up syntax

    Dim res as Variant
    res = Application.Match(tmp,Range("Lookup!A1:A980"),0)
    If not iserror(res) Then
    MsgBox "found!"
    Else
    beep
    End If

    --
    Regards,
    Tom Ogilvy


    "Pierre" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi all,
    >
    > I made a small form to enter data in an excel sheet
    >
    > Before accepting each record, i want to validate a code number
    >
    > If the code exist in a simple colum on an other sheet name lookup i will
    > add the data
    > otherwise i will beep to make a warning.
    >
    > if i write
    >
    > If VLookup(tmp, "lookup!a1:a980", 2) Then
    > MsgBox "found!"
    > Else
    > beep
    > End If
    >
    > vba tell me vlookup does not exist ???
    > the sheet llok up is like
    > a1 b1
    > code1 1
    > code2 1
    > code3 1
    >
    > Help
    >
    > Pierre
    >
    >




  3. #3
    Pierre
    Guest

    Re: look up syntax

    Great, it works !!!
    thanks,



    Tom Ogilvy a écrit dans le message ...
    >Dim res as Variant
    >res = Application.Match(tmp,Range("Lookup!A1:A980"),0)
    >If not iserror(res) Then
    > MsgBox "found!"
    >Else
    > beep
    >End If
    >
    >--
    >Regards,
    >Tom Ogilvy
    >
    >
    >"Pierre" <[email protected]> wrote in message
    >news:%[email protected]...
    >> Hi all,
    >>
    >> I made a small form to enter data in an excel sheet
    >>
    >> Before accepting each record, i want to validate a code number
    >>
    >> If the code exist in a simple colum on an other sheet name lookup i will
    >> add the data
    >> otherwise i will beep to make a warning.
    >>
    >> if i write
    >>
    >> If VLookup(tmp, "lookup!a1:a980", 2) Then
    >> MsgBox "found!"
    >> Else
    >> beep
    >> End If
    >>
    >> vba tell me vlookup does not exist ???
    >> the sheet llok up is like
    >> a1 b1
    >> code1 1
    >> code2 1
    >> code3 1
    >>
    >> Help
    >>
    >> Pierre
    >>
    >>

    >
    >




+ 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