LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Count occurrences of filename in column

If you want to speed it up you can go through an array instead of going
through the cells:

Dim R As Long, Values As Variant
Values = Range("H1:H" & UsedRange.Rows.Count) 'or whatever your range is
For R = 1 To UBound(Values, 1)
If InStr(Values(R, 1), "something") Then DoSomething
Next R

Stefano

"Lucky" wrote:

Thanks, Mike. Yours doesn't use Find and FindNext, but it's cleaner
than what I have, so I'll probably use it. One little problem is that
if one of the occurrences if removed for some reason, then the count
will be off. For instance, if the highest numbered entry is
"myfile(8).xls" and for some reason "myfile(4).xls" has been removed,
then just counting and adding 1 would duplicate one. Only 7 would be
counted, and "myfile(8).xls" would be added again. So, I have to use
something like

If InStr(Cells(g, "h"), "myfile") = 1 And InStr(Cells(g, "h"),
".xls") 0 Then
myStart = InStr(Cells(g, "h"), "(")
If myStart 0 Then myEnd = InStr(Cells(g, "h"), ")")
If myEnd 0 Then
nbrstr = Mid(Cells(g, "h"), myStart + 1, myEnd -
1)
If Val(nbrstr) biggest Then biggest = Val
(nbrstr)
End If
End If

Then, I have to add 1 to the biggest and use that for the next one.
Not really hard to do, but it does slow down things a bit. Only way I
know to do it,though. Any ideas on this? Thanks again!
.

 
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 how many occurrences Sunnyskies Excel Discussion (Misc queries) 3 March 17th 09 01:11 PM
Count Occurrences In A Column, Then Display In A Table Paperback Writer Excel Discussion (Misc queries) 3 September 14th 07 03:41 PM
Need column evaluated to count total of occurrences of "Y". How? learning Excel Worksheet Functions 2 June 12th 06 01:55 AM
Count Number of Occurrences in a Column anniejhsu Excel Worksheet Functions 7 May 31st 06 09:29 AM
Count occurrences of values in a column??!! me123 Excel Worksheet Functions 5 May 10th 06 08:24 PM


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