LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Count number of like occurences across all worksheet within wo

To make it simpler i can dump all the data into one sheet and work with that.
Let me know if that will make the code simpler. Thanks.

"Versace77" wrote:

GTVT06,

Sorry, I forgot to mention where it is hanging up. It is hanging up near
the end "If Dupe < "" And Dupe = Dupe2 Then..."

Thanks!


"Versace77" wrote:

Thanks for the updated code. When attempting to run the macro here's what
happens: Macro makes the summary sheet active, hourglass appears for 10 or
so seconds and then nothing. Just a blank sheet.

I'll forward you the .xls that i'm using so you can get an idea or maybe see
something that is missing.

Thanks again GTV.

Mike

"GTVT06" wrote:

Ok, heres the revised code. Inside the commented box change "Summary"
to whatever the actual summary sheet name is, change "U" to the letter
of the column that you would like to use to show the number of
instances, and change "2" to the number of the row in which the data
starts in.(i.e. I entered 2 assuming there was one row of headers and
data begins in row 2). Let me know if this works for you or if you
have any questions.

Sub Test()
Dim cell, cell2 As Range
Dim Dupe, Dupe2 As String
Dim LRow, LRow2, i, i2, DRow As Long
Dim n, DCol As String
'===================================
n = "Summary" 'Name Of Summary Sheet
DCol = "U" 'Column to show count
DRow = 2 'Row to begin count
'===================================
Worksheets(n).Activate

LRow = Worksheets(n).Range("A65536").End(xlUp).Row
Worksheets(n).Range(DCol & DRow & ":" & DCol & LRow).ClearContents
For Each cell In Worksheets(n).Range("A" & DRow & ":A" & LRow)
i = cell.Row
Dupe = Worksheets(n).Range("A" & i).Value &
Worksheets(n).Range("B" & i).Value & Worksheets(n).Range("C" &
i).Value _
& Worksheets(n).Range("D" & i).Value & Worksheets(n).Range("E" &
i).Value & Worksheets(n).Range("F" & i).Value _
& Worksheets(n).Range("G" & i).Value & Worksheets(n).Range("H" &
i).Value & Worksheets(n).Range("I" & i).Value _
& Worksheets(n).Range("J" & i).Value & Worksheets(n).Range("K"
& i).Value & Worksheets(n).Range("L" & i).Value _
& Worksheets(n).Range("M" & i).Value & Worksheets(n).Range("N"
& i).Value & Worksheets(n).Range("O" & i).Value _
& Worksheets(n).Range("P" & i).Value &
Worksheets(n).Range("Q" & i).Value & Worksheets(n).Range("R" &
i).Value _
& Worksheets(n).Range("S" & i).Value &
Worksheets(n).Range("T" & i).Value
Dim n2 As Single
For n2 = 1 To Sheets.Count
If Worksheets(n2).Name = Worksheets(n).Name Then GoTo nx
LRow2 = Worksheets(n2).Range("A65536").End(xlUp).Row
For Each cell2 In Worksheets(n2).Range("A1:A" & LRow2)
i2 = cell2.Row
Dupe2 = Worksheets(n2).Range("A" & i2).Value &
Worksheets(n2).Range("B" & i2).Value & Worksheets(n2).Range("C" &
i2).Value _
& Worksheets(n2).Range("D" & i2).Value & Worksheets(n2).Range("E"
& i2).Value & Worksheets(n2).Range("F" & i2).Value _
& Worksheets(n2).Range("G" & i2).Value &
Worksheets(n2).Range("H" & i2).Value & Worksheets(n2).Range("I" &
i2).Value _
& Worksheets(n2).Range("J" & i2).Value &
Worksheets(n2).Range("K" & i2).Value & Worksheets(n2).Range("L" &
i2).Value _
& Worksheets(n2).Range("M" & i2).Value &
Worksheets(n2).Range("N" & i2).Value & Worksheets(n2).Range("O" &
i2).Value _
& Worksheets(n2).Range("P" & i2).Value &
Worksheets(n2).Range("Q" & i2).Value & Worksheets(n2).Range("R" &
i2).Value _
& Worksheets(n2).Range("S" & i2).Value &
Worksheets(n2).Range("T" & i2).Value

If Dupe < "" And Dupe = Dupe2 Then Worksheets(n).Range(DCol &
i).Value = Worksheets(n).Range(DCol & i).Value + 1
Next cell2
nx:
Next n2
Next cell
End Sub

 
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
Count number of occurences in a list Lucas Reece Excel Worksheet Functions 12 May 28th 09 10:23 PM
how to count the number of occurences of a letter ? [email protected] Excel Discussion (Misc queries) 3 November 26th 08 02:30 PM
Creating number formula to count number occurences in a data set Brreese24 Excel Programming 1 August 23rd 07 11:18 PM
How to count number of occurences of two different things at once? Cairan O'Toole Excel Worksheet Functions 6 August 12th 07 10:12 AM
count number of occurences within a string Gabriel Excel Worksheet Functions 2 November 25th 04 04:17 PM


All times are GMT +1. The time now is 07:58 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"