Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default countif - in an entire workbook

Hi I need some kind formula to Countif (all the cells in whole
workbook / worksheet) for a certain text string.

johnnboy

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default countif - in an entire workbook

On Sep 25, 4:33*pm, Johnnyboy5 wrote:
Hi *I need some kind formula to Countif (all the cells in whole
workbook / worksheet) for a certain text string.

johnnboy


This will count all the cells in all the worksheets containing "hello"

Sub SuperCount()
Dim r As Range
SuperCounter = 0
s = "hello"
For Each sh In Sheets
sh.Activate
For Each r In ActiveSheet.UsedRange
If r.Value = s Then
SuperCounter = SuperCounter + 1
End If
Next
Next
MsgBox SuperCounter
End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default countif - in an entire workbook

On 26 Sep, 01:09, James Ravenswood wrote:
On Sep 25, 4:33*pm, Johnnyboy5 wrote:

Hi *I need some kind formula to Countif (all the cells in whole
workbook / worksheet) for a certain text string.


johnnboy


This will count all the cells in all the worksheets containing "hello"

Sub SuperCount()
Dim r As Range
SuperCounter = 0
s = "hello"
For Each sh In Sheets
* * sh.Activate
* * For Each r In ActiveSheet.UsedRange
* * * * * * If r.Value = s Then
* * * * * * * * SuperCounter = SuperCounter + 1
* * * * * * End If
* * Next
Next
MsgBox SuperCounter
End Sub


Thanks that works just great, I can see what I really need now, to
just count all the "hello" in the same column "n" in each worksheet
with the workbook.

Can it be done ?

thanks

Johnny
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default countif - in an entire workbook

On Sep 26, 4:30*am, Johnnyboy5 wrote:
On 26 Sep, 01:09, James Ravenswood wrote:





On Sep 25, 4:33*pm, Johnnyboy5 wrote:


Hi *I need some kind formula to Countif (all the cells in whole
workbook / worksheet) for a certain text string.


johnnboy


This will count all the cells in all the worksheets containing "hello"


Sub SuperCount()
Dim r As Range
SuperCounter = 0
s = "hello"
For Each sh In Sheets
* * sh.Activate
* * For Each r In ActiveSheet.UsedRange
* * * * * * If r.Value = s Then
* * * * * * * * SuperCounter = SuperCounter + 1
* * * * * * End If
* * Next
Next
MsgBox SuperCounter
End Sub


Thanks *that works just great, I can see what I really need now, *to
just count *all the "hello" in the same column "n" *in each worksheet
with the workbook.

Can it be done ?

thanks

Johnny- Hide quoted text -

- Show quoted text -


This might be quicker than a loop for text.

Option Explicit
Sub countjune()
Dim ws As Worksheet
Dim mycol As Range
Dim mc As Long
For Each ws In Worksheets
Set mycol = ws.Columns("N")
mc = mc + Application.CountIf(mycol, "Hello")
Next ws
MsgBox mc
End Sub
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
Name an Entire Workbook NaBellFL Excel Discussion (Misc queries) 3 November 15th 07 03:49 PM
Name an Entire Workbook NaBellFL Excel Discussion (Misc queries) 0 November 15th 07 02:24 PM
How to Copy entire Worksheet from Workbook S to Workbook D kris Excel Programming 3 June 20th 07 02:03 PM
countif across entire workbook Dave Breitenbach Excel Worksheet Functions 1 September 22nd 06 09:50 PM
Searching an Entire Workbook SlimSlender Excel Programming 1 December 11th 04 10:34 PM


All times are GMT +1. The time now is 05:42 AM.

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"