+ Reply to Thread
Results 1 to 3 of 3

Another Vlookup

  1. #1
    Registered User
    Join Date
    06-26-2006
    Posts
    11

    Another Vlookup

    Is it possible to use the Vlookup command in VB. The reason is that I want a value entered and then the lookup function performed to enter data into the required sheet. This is so that I don't have formulas in the sheet itself.

    I have tried doing it in VB with the same syntax as I would in a worksheet but get an error: sub or function not defined (with VLookup highlighted)

    Here is the Code:

    Sub AddTask_Click()
    '
    ' AddTask_Click Macro
    ' Macro recorded 09/10/2006 by BoB
    '
    Dim Username As String
    Dim Firstname As String
    Dim Lastname As String
    Dim Centre As String
    Dim Course As String


    Username = Range("E3")
    Course = Range("E5")

    If Username = "" Then
    MsgBox "Please Enter a Username"
    ElseIf Course = "" Then
    MsgBox "Please Enter a Course"
    Else

    Firstname = VLookup(Username, Jungle, 3, False)
    Lastname = VLookup(Username, Jungle, 4, False)
    Centre = VLookup(Username, Jungle, 2, False)

    InsertLine

    Range("TaskList!B5") = Firstname
    Range("TaskList!B6") = Lastname
    Range("TaskList!B7") = Centre
    Range("TaskList!B8") = Course


    End If

    Sheets("Front").Select
    Range("E3") = Null
    Range("E5") = Null

    Range("E3").Select


    End Sub


    Thanks in advance

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475
    I made some changes, I don't know if it works but it hasn't come up with any VBA errors when I debug it...

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-26-2006
    Posts
    11

    Smile Thanks

    Cheers mate

+ 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