Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Counting names thru code

How does one count the number of times Tommy is present in
Column A (starting at A7) of Sheet 1 when I am in Sheet4?

I tried using:
With Worksheets("Sheets1
Selection.FormulaR1C1 = "=COUNTIF(Sheet1!RC[7]:end
(xlDown),""Tommy"")" but it did not work.

Anyone know how to correct my confused code above?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Counting names thru code

Try this


Private Sub CommandButton1_Click()

For x = 7 To 1000

If Range("A" & x) = "Tommy" Then y = y + 1

Next x

Range("B1") = y

End Sub



"Tom Jameson" wrote in message
...
How does one count the number of times Tommy is present in
Column A (starting at A7) of Sheet 1 when I am in Sheet4?

I tried using:
With Worksheets("Sheets1
Selection.FormulaR1C1 = "=COUNTIF(Sheet1!RC[7]:end
(xlDown),""Tommy"")" but it did not work.

Anyone know how to correct my confused code above?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Counting names thru code

or

Selection.FormulaR1C1 = "=COUNTIF(Sheet1!R7C1:R" & _
Worksheets("Sheet1").Cells(7, "A").End(xlDown).Row & _
"C1,""Tommy"")"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mike Tomasura" wrote in message
...
Try this


Private Sub CommandButton1_Click()

For x = 7 To 1000

If Range("A" & x) = "Tommy" Then y = y + 1

Next x

Range("B1") = y

End Sub



"Tom Jameson" wrote in message
...
How does one count the number of times Tommy is present in
Column A (starting at A7) of Sheet 1 when I am in Sheet4?

I tried using:
With Worksheets("Sheets1
Selection.FormulaR1C1 = "=COUNTIF(Sheet1!RC[7]:end
(xlDown),""Tommy"")" but it did not work.

Anyone know how to correct my confused code above?





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
using the Excel generic worksheet names instead of user-given names in code Paul Excel Discussion (Misc queries) 5 June 26th 09 08:44 PM
counting names wildauk Excel Discussion (Misc queries) 3 February 20th 08 01:33 AM
counting of names ekkeindoha Excel Discussion (Misc queries) 2 February 13th 08 09:13 AM
counting names [email protected] Excel Worksheet Functions 4 June 18th 07 11:36 AM
Counting names in a column but counting duplicate names once TBoe Excel Discussion (Misc queries) 9 May 11th 05 11:24 PM


All times are GMT +1. The time now is 02:54 AM.

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

About Us

"It's about Microsoft Excel"