+ Reply to Thread
Results 1 to 3 of 3

countif usage in macro

  1. #1
    Registered User
    Join Date
    02-08-2006
    Posts
    9

    countif usage in macro

    if i give the function =countif(sheet1!E2:E12,"=Europe") in blank shell of excel ,it gives no of rows having the word europe in the column E . but if i give the same commend in macro it shows syntax error .


    Sub parthamacro()
    '
    ' parthamacro Macro
    ' Macro recorded 2/8/2006 by 128304
    '

    '
    Dim nResult As Long
    nResult = sheet1.countif(sheet1!E2:E12,"=Europe")

    End Sub


    can you please help me , how to use countif function in macros

  2. #2
    Don Guillett
    Guest

    Re: countif usage in macro

    You can help yourself by looking at the vba help index or answer for
    worksheet functions.

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "parthaemail" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > if i give the function =countif(sheet1!E2:E12,"=Europe") in blank
    > shell of excel ,it gives no of rows having the word europe in the
    > column E . but if i give the same commend in macro it shows syntax
    > error .
    >
    >
    > Sub parthamacro()
    > '
    > ' parthamacro Macro
    > ' Macro recorded 2/8/2006 by 128304
    > '
    >
    > '
    > Dim nResult As Long
    > nResult = sheet1.countif(sheet1!E2:E12,"=Europe")
    >
    > End Sub
    >
    >
    > can you please help me , how to use countif function in macros
    >
    >
    > --
    > parthaemail
    > ------------------------------------------------------------------------
    > parthaemail's Profile:
    > http://www.excelforum.com/member.php...o&userid=31311
    > View this thread: http://www.excelforum.com/showthread...hreadid=510077
    >




  3. #3
    Dave Peterson
    Guest

    Re: countif usage in macro

    Dim myRng as range
    dim nResult as long
    set myrng = worksheets("sheet1").range("e2:E12")
    nresult = application.countif(myrng,"europe")




    parthaemail wrote:
    >
    > if i give the function =countif(sheet1!E2:E12,"=Europe") in blank
    > shell of excel ,it gives no of rows having the word europe in the
    > column E . but if i give the same commend in macro it shows syntax
    > error .
    >
    > Sub parthamacro()
    > '
    > ' parthamacro Macro
    > ' Macro recorded 2/8/2006 by 128304
    > '
    >
    > '
    > Dim nResult As Long
    > nResult = sheet1.countif(sheet1!E2:E12,"=Europe")
    >
    > End Sub
    >
    > can you please help me , how to use countif function in macros
    >
    > --
    > parthaemail
    > ------------------------------------------------------------------------
    > parthaemail's Profile: http://www.excelforum.com/member.php...o&userid=31311
    > View this thread: http://www.excelforum.com/showthread...hreadid=510077


    --

    Dave Peterson

+ 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