Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
PivotTable Macro Reverts to Count Function LTofsrud Excel Worksheet Functions 4 February 8th 05 09:41 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
A count function or macro needed dkenebre Excel Programming 2 November 15th 03 06:00 PM


All times are GMT +1. The time now is 09:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"