+ Reply to Thread
Results 1 to 5 of 5

VBA - “Run-time error 424: object required”

  1. #1
    Registered User
    Join Date
    05-17-2013
    Location
    Florida, US
    MS-Off Ver
    Excel 2007
    Posts
    6

    VBA - “Run-time error 424: object required”

    So although I feel the need to mention that I’ve already made several posts on here regarding this project, I’ve since made some progress on it:

    For those that haven’t read any of my prior posts, I have a database of names for an online membership site, for some of which the genders have been assigned with VLOOKUP from a 6,000 name long list on another sheet. For the rest, they come up as “ERR”, which is where the VB code would search up the name on a gender guesser website and be able to return an “F”, “M”, or ‘U” (unknown) for those cells. The function I used all the cells throughout the gender column is as follows:

    =IF(ISERROR(VLOOKUP($A41,NameDatabase!$A$2:$B$8000,2,FALSE)),"ERR",VLOOKUP($A41,NameDatabase!$A$2:$B$8000,2,FALSE))

    And the VBA code to take care of the rest is as follows:


    Please Login or Register  to view this content.
    I’m pretty much an absolute beginner at VBA, and most of my code was cobbled together from 4-5 different sources. Although I mentioned that I was getting the “Run-time error 424: object required” message, I am fairly sure that other errors exist in my code, so please feel free to point those out, as well.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA - “Run-time error 424: object required”

    GenderText is no an object variable, so has no properties like Value.

    So remove .Value her and in the rest of the code.
    Please Login or Register  to view this content.
    If you actually want GenderText to refer to dbsheet.Cells(SelRow, 8) then declare it at the top of the code as Range and use Set.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    05-17-2013
    Location
    Florida, US
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: VBA - “Run-time error 424: object required”

    Thanks, Norie! I no longer get that error message! However, I noticed that the code will only run when an "ERR" cell is selected in the sheet, and I would be required to continue manually selecting these cells down the column myself until I was satisfied (or bored :P)

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA - “Run-time error 424: object required”

    That's because GenderText never changes.

    Try moving this within the loop and replacing SelRow with Row.
    Please Login or Register  to view this content.
    Do the same for NamesText.

    By the way, you shoud move this outside the loop,
    Please Login or Register  to view this content.
    unless you want a whole bunch of Internet Explorer instances floating about all connected to the same website.

    If you put it outside the loop you will only have one instance which you can reuse over and over.

  5. #5
    Registered User
    Join Date
    05-17-2013
    Location
    Florida, US
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: VBA - “Run-time error 424: object required”

    Thanks, it works great now! Perchance, do you know if there is code to enable me to multitask within the spreadsheet without getting a "Run time error 1004: application defined or object defined error" message AND/OR to open up more than one IE window at a time to speed up the gender insertion process? Thanks so much again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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