+ Reply to Thread
Results 1 to 5 of 5

VBA Run-Time error code 5

  1. #1
    Registered User
    Join Date
    02-13-2014
    Location
    saudi arabia
    MS-Off Ver
    Excel 2010
    Posts
    3

    VBA Run-Time error code 5

    Hello Experts,

    I need your help with the attached excel macro enabled file

    As soon as I click on "Run", a debug message appears. I would appreciate it if you could resolve this debugging issue. (Attached image)

    I look forward to receiving a favorable response from you.


    Thank you..
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    11-29-2022
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    430

    Re: VBA Run-Time error code 5

    So z is a collection and the line of code it's bugged on is trying to access an element in that collection. Elements are identified by number and you have Cstr in there, which is converting to a string. Can trying changing that cstr to cint.

  3. #3
    Registered User
    Join Date
    02-13-2014
    Location
    saudi arabia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: VBA Run-Time error code 5

    Thanks for your comments,

    It has been changed in accordance with your instructions, but the result remains the same. (debug)

    Should I change any settings in the VBA module or choose any references from the library to avoid the Run_time errror 5 ?
    Last edited by ans1718; 12-16-2022 at 02:53 AM.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,446

    Re: VBA Run-Time error code 5

    I would suggest you take out the On Error Resume Next and see what other errors you get.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    02-13-2014
    Location
    saudi arabia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: VBA Run-Time error code 5

    Thanks for your reply, getting mismatch error then, could u check the attached excel file with codes?

+ 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. Error Handling: Need simple code for Run-time Error
    By romsky26 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-28-2021, 08:59 AM
  2. Error code "run time error 9: subscript out of range
    By iBennett93 in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 06-28-2021, 05:03 AM
  3. [SOLVED] Why am I Getting a Run-time Error '91' error after adding CurrentUser to code below?
    By gmr4evr1 in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 06-14-2015, 06:24 PM
  4. Need to add if error code to worksheet change event to stop a run-time error
    By KT99 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-18-2014, 03:10 PM
  5. vba code throws an error first time but runs perfectly the second time. HELP!!
    By mvneema in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2014, 12:42 PM
  6. Replies: 4
    Last Post: 11-15-2013, 05:03 PM
  7. VBA Code...error = run time error 1004 autofilter method of range class failed
    By Dariusd7 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-15-2013, 04:49 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