+ Reply to Thread
Results 1 to 11 of 11

FormatConditions.Add - Invalid Procedure Call when trying to add IsNumber(Search))

  1. #1
    Registered User
    Join Date
    04-04-2022
    Location
    Poland
    MS-Off Ver
    office 365
    Posts
    5

    FormatConditions.Add - Invalid Procedure Call when trying to add IsNumber(Search))

    Hey,

    I want to ask what is wrong with this code? When I'm trying to add it, it return an Error "Invalid Procedure call or argument". I can't figure why.

    The formula is working well in Excel if added manually :/

    Please Login or Register  to view this content.
    The code above resolves to:
    Please Login or Register  to view this content.
    The formula works great if put on cell (even by vba) and also works if put manually on conditional formatting. So why doesn't it work when used by vba?


    I tried it also on empty workbook so it's not workbook-specified.
    Last edited by Clear; 04-04-2022 at 12:18 PM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: FormatConditions.Add - Invalid Procedure Call when trying to add IsNumber(Search))

    Change the dim from

    Dim cf

    to
    Dim cf as range

  3. #3
    Registered User
    Join Date
    04-04-2022
    Location
    Poland
    MS-Off Ver
    office 365
    Posts
    5

    Re: FormatConditions.Add - Invalid Procedure Call when trying to add IsNumber(Search))

    Quote Originally Posted by AB33 View Post
    Change the dim from

    Dim cf

    to
    Dim cf as range
    Unfortunately, it doesn't change anything. I didn't add it because to be exact it returns a FormatConditions object. Changing type to others also doesn't work.
    The code works when I use other formulas, just this one formula seems to be bugging Excel and I can't get why.
    It's just a fragment of code I copied to empty workbook to make sure, it's a part that makes problems.
    Last edited by Clear; 04-04-2022 at 12:20 PM.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: FormatConditions.Add - Invalid Procedure Call when trying to add IsNumber(Search))

    It is because you are on active cell, but when you run your cursor might not be on active cell.
    Remove active cell and replace it by proper referencing a cell or range, or make sure that the cursor on the active cell when you run the code.

  5. #5
    Registered User
    Join Date
    04-04-2022
    Location
    Poland
    MS-Off Ver
    office 365
    Posts
    5

    Re: FormatConditions.Add - Invalid Procedure Call when trying to add IsNumber(Search))

    Using ActiveCell was just to simplifying now. It seems it's formula that excel hates that's why I simplified everything other to focus on Formula.

    I changed a code to clarification.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Clear; 04-04-2022 at 06:20 AM.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: FormatConditions.Add - Invalid Procedure Call when trying to add IsNumber(Search))

    The last attachment fails—can't download it.

  7. #7
    Registered User
    Join Date
    04-04-2022
    Location
    Poland
    MS-Off Ver
    office 365
    Posts
    5

    Re: FormatConditions.Add - Invalid Procedure Call when trying to add IsNumber(Search))

    I reuploaded it on this post.
    Attached Files Attached Files

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

    Re: FormatConditions.Add - Invalid Procedure Call when trying to add IsNumber(Search))

    Since you are in Poland, I'd assume you use semicolons not commas as list separators, so you need:

    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: FormatConditions.Add - Invalid Procedure Call when trying to add IsNumber(Search))

    I have recoded a macro to test it as I can't remember the syntax of CF. I did not get or see any error. I presume you are missing the colouring bit.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-04-2022
    Location
    Poland
    MS-Off Ver
    office 365
    Posts
    5

    Re: FormatConditions.Add - Invalid Procedure Call when trying to add IsNumber(Search))

    Quote Originally Posted by rorya View Post
    Since you are in Poland, I'd assume you use semicolons not commas as list separators, so you need:

    Please Login or Register  to view this content.
    Bro, I would hug you if I could. That was the case. It has to be entered exactly as if I would enter it manually, so semicolons and I would have to translate formulas.
    That's complete bullshit. If it wasn't for you, I would never expect that.

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

    Re: FormatConditions.Add - Invalid Procedure Call when trying to add IsNumber(Search))

    It is a very stupid and inconsistent thing in Excel, sadly.

+ 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] Invalid procedure call argument
    By plans in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2020, 01:23 PM
  2. Invalid procedure call or Argument (please help)
    By Glervey in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-15-2019, 12:46 PM
  3. Invalid procedure call or argument?
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2017, 10:15 AM
  4. Invalid Procedure Call or Argument?
    By aloha31 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2013, 08:24 PM
  5. Invalid Procedure Call (Mid fxn)
    By za20001 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-26-2011, 08:20 AM
  6. Invalid procedure call or argument
    By mqdias in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-08-2007, 06:01 AM
  7. Invalid Procedure call or argument
    By T De Villiers in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2006, 10:05 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