Results 1 to 5 of 5

worksheetfunction.countifs with loop

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    10-21-2011
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    513

    worksheetfunction.countifs with loop

    hi there,

    I'm testing out a VBA using application.worksheetfunction.countifs()

    Dim n As Integer
    Dim result As Double
    Dim lastr As Integer
    lastr = Worksheets("Sheet1").UsedRange.Rows.Count
    
    For n = 2 To lastr
    result = Application.WorksheetFunction.CountIfs(Cells(n, 1), "O", Cells(n, 2), "Yes")
    Next n
    Worksheets("Sheet1").Range("J1").Value = result
    When i hit the button, i keep getting 0.

    any ideas?

    I'm using excel 2010

    thank you
    Attached Files Attached Files
    Last edited by Lifeseeker; 02-02-2012 at 01:26 PM.

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