Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Searching into Non-Contiguous ranges in a columns

I couldn't find your file, but here's my offering:

Sub blah()
rw = 5 'first row to check in column A
LastRowToCheck = 35 'last row in column A to check (635 in your example)
myTIMES = 0
Do
StartRow = 0
EndRow = 0
Do 'establishes zzz row
If Cells(rw, 1).Value = "zzz" Then StartRow = rw
rw = rw + 1
Loop Until StartRow < 0 Or rw LastRowToCheck
Do 'establishes next yyy row
If Cells(rw, 1).Value = "yyy" Then EndRow = rw
rw = rw + 1
Loop Until EndRow < 0 Or rw LastRowToCheck
i = StartRow + 1
Do ' checks for 12v/12t sequence and counts them
If Cells(i, 1) = "12v" And Cells(i + 1, 1) = "12t" Then myTIMES =
myTIMES + 1
i = i + 1
Loop Until (i EndRow - 2 And EndRow < 0) Or i LastRowToCheck
Loop Until rw 35
MsgBox "12t has immediately followed 12v " & myTIMES & " times after zzz and
before yyy"
End Sub

--
p45cal


"Carlo Gonella" wrote:

Hi everyone.
In the attachment you can see an easy example of what I need to have with
the coding I can't actually figure out.. ( VIRUS FREE ).
Hope someone can help !

Thanks in advance.

---------------------------------------------------------------------------------------------------------------------------
Assuming I have a colum of codes

Range("A:A") ...

I know my codes are from A5 to A635.
I also know there are some codes I can identify and which have relevant
meaning in statistic analysis I have to do.
I also know I need to analyze the codes between certain 'sequences'.

i.e. :

In the A5--A635 cells, I have 9 times the 'zzz' code.
And in the same range, I have 8 times the 'yyy' code.

I need to search this :

How many times the code

12t
comes exactly after the code
12v
( ie 12v in cell A7, 12t in cell A8 )

but ONLY when they are in a range delimited between 'zz'z and 'yyy' ?
[snip]
I hope it's clear and it's just something I miss...
I can find anything I want to analyze...
But not in multiple and non-contiguous ranges...

Thank you for any hint.


CarloG



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
Searching into Non-Contiguous ranges in a columns Don Guillett Excel Programming 2 July 15th 07 09:56 PM
Non contiguous ranges AD108 Excel Programming 4 November 23rd 06 03:59 PM
Copying non-contiguous columns to contiguous columns Bob Excel Programming 1 August 10th 06 03:45 AM
summing non contiguous ranges valaor Excel Discussion (Misc queries) 6 March 22nd 06 04:17 PM
sorting non contiguous ranges gsh20 Excel Discussion (Misc queries) 1 September 8th 05 04:50 PM


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