+ Reply to Thread
Results 1 to 7 of 7

Performing Countif function within VBA

  1. #1
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Performing Countif function within VBA

    Can't seem to get this syntax right.

    Establishing a unique list of column A in column K whick works fine, but then starting in L2 need a countif formula. I got it to work with the .FormulaR1C1 format, but how can this work with .Formula?

    Please Login or Register  to view this content.
    Last edited by jeffreybrown; 01-07-2011 at 05:51 PM.
    HTH
    Regards, Jeff

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Performing Countif function within VBA

    perhaps

    Please Login or Register  to view this content.

  3. #3
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Performing Countif function within VBA

    Perhaps

    Please Login or Register  to view this content.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Performing Countif function within VBA

    Something like

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Performing Countif function within VBA

    I am getting a run time error 1004 Method Range of Object Global Failed.

    This is the highligted line.
    Please Login or Register  to view this content.
    The formula starting in L2 should be =COUNTIF($A$2:$A$13,K2)

    Run the cursor over Set rng and it says rng = nothing

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Performing Countif function within VBA

    Please Login or Register  to view this content.

  7. #7
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Performing Countif function within VBA

    Thank you everybody. Works great...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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