+ Reply to Thread
Results 1 to 3 of 3

error message: argument not optional for CountIf function

  1. #1
    Forum Contributor
    Join Date
    02-27-2020
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    425

    error message: argument not optional for CountIf function

    Hi,


    I am trying to write a macro that places the values of yellow cells (with unique values in the row) in another worksheet. I am using a Countif function. I am getting "compile error: argument not optional " for
    Please Login or Register  to view this content.
    I alreadt tried to put "periode" between brackets but i get then the error message as well.


    Please Login or Register  to view this content.
    What am i doing wrong?
    Any input is much appreciated!
    Last edited by MaartenRo; 06-16-2020 at 07:21 AM.

  2. #2
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,416

    Re: error message: argument not optional for CountIf function

    You only supplied a range to the CountIf function but nothing to search for. What I marked in red is the range for CountIf to search in... something (what to be searched for) needs to go where I put the blue question marks.

    AmountLastPeriod = WorksheetFunction.CountIf(Range("H:H", Periode),???)
    Last edited by Rick Rothstein; 06-14-2020 at 10:18 PM.

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: error message: argument not optional for CountIf function

    try
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

+ 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] Using a With Statement within a Public Function ('Argument not Optional' Error)
    By stevoDE in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-15-2017, 07:31 AM
  2. Error for VBA function - "Argument Not Optional?"
    By EverGreen1231 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2017, 01:59 PM
  3. Using a Boolean function within an If statement: Argument not optional error message
    By elfsprin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-16-2011, 04:12 PM
  4. Please help with 'Argument Not Optional' error.
    By rkjudy in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-09-2011, 01:49 AM
  5. VBA getting argument not optional error
    By sulavsingh6 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2009, 01:06 PM
  6. Argument not optional Error 449! Need Help
    By bad_boyu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-26-2006, 08:00 AM
  7. error message: compile error, argument not optional
    By Pierre via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-05-2005, 11: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