+ Reply to Thread
Results 1 to 4 of 4

application.vlookup returns Run-error: Object required

Hybrid View

  1. #1
    Registered User
    Join Date
    09-15-2011
    Location
    Washington, OK
    MS-Off Ver
    Office 2010
    Posts
    23

    application.vlookup returns Run-error: Object required

    Hi all,

    I have a macro that I want to use to update username and password.
    All is well until I get to the application.vlookup part of the code, and it tells me an object is needed.

    I have messed with this until my eyes are bleeding. Any help would be tremendous, thanks!

    Windows 7, Excel 2010

    Sub UpdatePassword_Click()
    
    Dim CurrentUsername As Integer, CurrentPassword As Integer
    Dim Result1 As String, Result2 As String
    
    CurrentUsername = Range("O11").Value
    CurrentPassword = Range("O18").Value
    
    If Range("J16") = Range("N16") Then
       Result2 = Range("J15").Value
       
    End If
    
    If Range("J23") = Range("N23") Then
       Result2 = Range("J22").Value
    
    Application.VLookup(CurrentUsername, User_Login_Database.Range("D:H"), 4, False) = Result1
    Application.VLookup(CurrentPassword, User_Login_Database.Range("D:H"), 5, False) = Result2
    
    End If
    
    End Sub
    Casey Wells

    Most Appreciative Rookie!

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: application.vlookup returns Run-error: Object required

    May be this?

    Sub UpdatePassword_Click()
    Dim CurrentUsername As Integer, CurrentPassword As Integer
    Dim Result1 As String, Result2 As String
    
    CurrentUsername = Range("O11").Value
    CurrentPassword = Range("O18").Value
    
    With Application
        Result1 = .VLookup(CurrentUsername, User_Login_Database.Range("D:H"), 4, False)
        Result2 = .VLookup(CurrentPassword, User_Login_Database.Range("D:H"), 5, False)
    End With
    
    End Sub


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    09-15-2011
    Location
    Washington, OK
    MS-Off Ver
    Office 2010
    Posts
    23

    Re: application.vlookup returns Run-error: Object required

    Thanks for the response, but sadly that didn't work.

    I also tried this with no success either.

    
    Sub UpdatePassword_Click()
    
    Dim CurrentUsername As Integer, CurrentPassword As Integer
    Dim Result1 As String, Result2 As String
    
    CurrentUsername = Range("O11").Value
    CurrentPassword = Range("O18").Value
    
    If Range("J16") = Range("N16") Then
       Result2 = Range("J15").Value
       
    End If
    
    If Range("J23") = Range("N23") Then
       Result2 = Range("J22").Value
    
    End If
    
    With Application
        .VLookup(CurrentUsername, User_Login_Database.Range("D:H"), 4, False) = Result1
        .VLookup(CurrentPassword, User_Login_Database.Range("D:H"), 5, False) = Result2
    End With
    
    End Sub
    I read in another thread that my Integer may not work if it doesn't return a number value, so I manually changed it to see if it fixed it, but that didn't seem to work either...

    I'll keep at at and post back if i figure it out.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,009

    Re: application.vlookup returns Run-error: Object required

    What is User_Login_Database? Is it the codename of a worksheet, or the name you see on the worksheet tab? The latter won't work - you'd have to use Sheets("User_Login_Database")
    Everyone who confuses correlation and causation ends up dead.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Sort Macro Run-time error '1004': Application/Object-defined error.
    By sam1212 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2014, 10:05 AM
  2. Vlookup application or object defined error... cannot figure out what's wrong
    By lordterrin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-01-2014, 04:46 PM
  3. Replies: 0
    Last Post: 05-14-2012, 11:59 PM
  4. [SOLVED] Application.VLookup returns ZERO instead of a number
    By xenon99 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-05-2012, 06:42 PM
  5. Application Defined or Object Defined Error, Command Button and Vlookup Function
    By stevedomer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-14-2011, 11:20 PM
  6. Object Required error on Application.Match function.
    By ctckark1 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-12-2011, 11:01 AM
  7. VLOOKUP run-time error 424 object required
    By rudekid in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-30-2009, 09:03 AM

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