+ Reply to Thread
Results 1 to 3 of 3

Thread: Application.WorksheetFunction.CountIF

  1. #1
    Registered User
    Join Date
    05-17-2011
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    2

    Application.WorksheetFunction.CountIF

    Hi ,

    I am new to VBA programming ,

    I found the following function that was used to delete duplicate entries in the column F.
    Dim x1               As Long
    Dim LastRow         As Long
    
    LastRow = Range("F500").End(xlUp).Row
    For x1 = LastRow To 1 Step -1
            If Application.WorksheetFunction.CountIf(Range("F1:F" & x1), Range("F" & x1).Text) > 1 Then
                Range("F" & x1).EntireRow.Delete
            End If
        Next x1


    I am trying to understand and interpret the below function
    Application.WorksheetFunction.CountIf(Range("F1:F" & x1), Range("F" & x1).Text)

    Please let me know what this statement exactly does .

    Thanks,
    Krsna.
    Last edited by Leith Ross; 05-17-2011 at 05:18 AM. Reason: Added Code Tags

  2. #2
    Valued Forum Contributor
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2003
    Posts
    2,488

    Re: Application.WorksheetFunction.CountIF

    hi, krsna83_pp, please check attachment, column C, same Excel CountIF formula is used.

    The code does exactly the same moving every time 1 row up and counting occurances of value in the range F1:F...
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    05-17-2011
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Application.WorksheetFunction.CountIF

    Thanks much ,,,makes sense now .

+ 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.2.0