+ Reply to Thread
Results 1 to 4 of 4

VBA Log function Runtime Error '5': Invalid procedure call or argument

  1. #1
    Registered User
    Join Date
    02-22-2019
    Location
    Louisiana, US
    MS-Off Ver
    2016
    Posts
    2

    VBA Log function Runtime Error '5': Invalid procedure call or argument

    I am trying to use the VBA Log function in an expression and I expect it to work on any number greater than 0. However, when I enter a relatively large number (e.g. 500 or 1,000), I get the error mentioned in the title. Here is the function:

    Please Login or Register  to view this content.
    I am using Option Explicit and I get the error when I enter x as any number greater than about 500.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,275

    Re: VBA Log function Runtime Error '5': Invalid procedure call or argument

    Works just fine for me.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Registered User
    Join Date
    02-22-2019
    Location
    Louisiana, US
    MS-Off Ver
    2016
    Posts
    2

    Re: VBA Log function Runtime Error '5': Invalid procedure call or argument

    Maybe it has something to do with the sub I'm using the function in then? It gives the error if x is anything above exactly 403 (after further testing) and when I click "Debug" It highlights the line where I defined f_x.

    Full code:
    Please Login or Register  to view this content.

  4. #4
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: VBA Log function Runtime Error '5': Invalid procedure call or argument

    Simple enough answer. Numbers above 403 will cause next_guess to go below zero making the Log() call invalid.

    WBD
    Office 365 on Windows 11, looking for rep!

+ 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. Run time error 5, invalid procedure call or argument
    By arvimeld in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-06-2018, 09:11 AM
  2. [SOLVED] Invalid procedure call or argument error
    By maym in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-10-2016, 09:38 PM
  3. [SOLVED] runtime error 5, invalid procedure call or argument ??
    By tintin007 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2014, 05:25 AM
  4. Invalid procedure call or argument (Error 5)
    By vop2311 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-08-2014, 07:27 PM
  5. Runtime Error 5: Invalid procedure call or argument
    By Arasi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-07-2009, 11:49 AM
  6. Invalid procedure call or argument error
    By Patrick Simonds in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-12-2006, 06:45 PM
  7. [SOLVED] Run-time error '5': Invalid Procedure Call or Argument
    By Nikila in forum Excel General
    Replies: 2
    Last Post: 02-24-2006, 05:30 PM

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