+ Reply to Thread
Results 1 to 3 of 3

Macro and Count function

  1. #1
    Melissa
    Guest

    Macro and Count function

    I am recording a macro in Excel 2003 (do not know or use VBA Editor) that
    involves many different tasks in the worksheet. When I run the macro, it
    runs everything except the CountIF function I recorded. I am using the
    function to capture the number of times certain text appears in a column.
    Any assistance on getting the macro to record the function?

    Thanks.

  2. #2
    Bob Phillips
    Guest

    Re: Macro and Count function

    Do you want the formula inserted

    Activecell.Formula = "=COUNTIF(A1,A20,""some value"")"

    or get the result

    Msgbox Application.Countif(Range("A1:A20"),"some value")

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Melissa" <[email protected]> wrote in message
    news:[email protected]...
    > I am recording a macro in Excel 2003 (do not know or use VBA Editor) that
    > involves many different tasks in the worksheet. When I run the macro, it
    > runs everything except the CountIF function I recorded. I am using the
    > function to capture the number of times certain text appears in a column.
    > Any assistance on getting the macro to record the function?
    >
    > Thanks.




  3. #3
    Gary''s Student
    Guest

    RE: Macro and Count function

    n = Application.CountIf(Range("A:A"), Range("B1"))



    In VBA COUNTIF() needs to be spoon-fed the range.
    --
    Gary's Student


    "Melissa" wrote:

    > I am recording a macro in Excel 2003 (do not know or use VBA Editor) that
    > involves many different tasks in the worksheet. When I run the macro, it
    > runs everything except the CountIF function I recorded. I am using the
    > function to capture the number of times certain text appears in a column.
    > Any assistance on getting the macro to record the function?
    >
    > Thanks.


+ 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