+ Reply to Thread
Results 1 to 14 of 14

Inconsistent Run-time Error 424 for basic VBA script

  1. #1
    Registered User
    Join Date
    08-15-2018
    Location
    ???
    MS-Off Ver
    Office 2016
    Posts
    8

    Unhappy Inconsistent Run-time Error 424 for basic VBA script

    So, I'm running two basic scripts: One that adds prefixes to cells, the other which adds suffixes. These are being run on CSV files that are used for database purposes. Here is the suffix one:

    Please Login or Register  to view this content.
    These scripts had been working fine up until recently. Now, sometimes they work, and then sometimes they just won't execute. When I debug, I get a Run-time error 424: Object required. I don't know why I'm getting that error. I thought it was because the cells were locked (which they are by default for some reason, I don't know why). But it works sometimes when the cells are locked, and when it doesn't work, it doesn't seem to matter whether the cells are locked or not.

    I'm trying to figure out why it keeps happening. Is it because of the files themselves (which, despite having a CSV extension, Excel initially recognizes as Unicode Text)? Is it Excel? This is beginning to frustrate me, because it's part of a big project that I need to complete.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Inconsistent Run-time Error 424 for basic VBA script

    It's hard to replicate the problem.


    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and click "manage attachments" to open the upload window.


    To add a file to a post

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

    Re: Inconsistent Run-time Error 424 for basic VBA script

    Which line of code do you get the error on?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    08-15-2018
    Location
    ???
    MS-Off Ver
    Office 2016
    Posts
    8

    Re: Inconsistent Run-time Error 424 for basic VBA script

    Quote Originally Posted by Norie View Post
    Which line of code do you get the error on?
    Line 10 in this code.

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Inconsistent Run-time Error 424 for basic VBA script

    Due to this line of code
    Please Login or Register  to view this content.
    I'm surprised you get any error messages.
    Also which line do you think is line 10?

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Inconsistent Run-time Error 424 for basic VBA script

    Deleted as duplicated

  7. #7
    Registered User
    Join Date
    08-15-2018
    Location
    ???
    MS-Off Ver
    Office 2016
    Posts
    8

    Re: Inconsistent Run-time Error 424 for basic VBA script

    Quote Originally Posted by Fluff13 View Post
    Due to this line of code
    Please Login or Register  to view this content.
    I'm surprised you get any error messages.
    Also which line do you think is line 10?
    When I debug, I remove that line to ascertain the error.

    Also, I meant Line 11, which here is:
    Please Login or Register  to view this content.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Inconsistent Run-time Error 424 for basic VBA script

    It is hard to believe protected csv, but have you tried
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-15-2018
    Location
    ???
    MS-Off Ver
    Office 2016
    Posts
    8

    Re: Inconsistent Run-time Error 424 for basic VBA script

    Quote Originally Posted by jindon View Post
    It is hard to believe protected csv, but have you tried
    Please Login or Register  to view this content.
    That didn't take.

    Further analysis, this is the line that triggers Error 424:
    Please Login or Register  to view this content.
    Also, I should note: When Excel initially opens these CSV files, they are treated initially as spreadsheets but save as text files. Subsequent opens result in a Text Wizard opening, followed by the sheet turning to an incoherent blob of data. I'm not sure if that's of any significance.

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Inconsistent Run-time Error 424 for basic VBA script

    Delete (wrong thread)

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

    Re: Inconsistent Run-time Error 424 for basic VBA script

    What range are you trying to select/set here?
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    08-15-2018
    Location
    ???
    MS-Off Ver
    Office 2016
    Posts
    8

    Re: Inconsistent Run-time Error 424 for basic VBA script

    Quote Originally Posted by Norie View Post
    What range are you trying to select/set here?
    Please Login or Register  to view this content.
    The usual range I input is for a single column, save the top cell (which is a field rather than a value for what it's being used for). I run these scripts a few times for different columns.

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

    Re: Inconsistent Run-time Error 424 for basic VBA script

    Do you need to manually select the columns?

  14. #14
    Registered User
    Join Date
    08-15-2018
    Location
    ???
    MS-Off Ver
    Office 2016
    Posts
    8

    Re: Inconsistent Run-time Error 424 for basic VBA script

    Quote Originally Posted by Norie View Post
    Do you need to manually select the columns?
    I can either manually select the columns or type them into the input box.

+ 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. Help with script that result in Run-time error
    By excelnabb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-08-2018, 02:02 PM
  2. Replies: 5
    Last Post: 06-16-2015, 01:12 PM
  3. [SOLVED] Getting Run Time Error 9: Sub script out of Range.
    By navbains in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-02-2015, 03:24 PM
  4. run time error 9: script out of range?
    By sanjayrshn.hzb in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 08-04-2014, 05:38 PM
  5. [SOLVED] Run Time Error 9 " Script out of range
    By vaibhav2312 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-10-2013, 08:10 AM
  6. [SOLVED] weird problem with inconsistent output from VBA script
    By rducky26 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-04-2012, 02:54 PM
  7. Course Bookings Run-time error '9': Script out of range
    By tomsmart@smart- in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-18-2008, 10:45 PM

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