Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi -
I have two lists that I'm randomizing by sorting each one with a column of =rand(). The lists both contain negative and positive words. If a positive word is in list 1 and a negative in list 2, let's call that 1pos-2neg. I need to have an even number of 1pos-2pos, 1pos-2neg, 1neg-2pos, and 1neg-2neg. So I have a countif cell that determines the number of 1pos-2pos I have and another countif cell that tells me how many 1pos-2neg I have and so on. Then an "if" formula says all the countif cells have to be the same and if they are it says "MATCH". Then I just keep sorting until this cell says "MATCH." Is there any excel code that basically says "After selecting columns M and N, keep sorting column N until cell AA22 says "MATCH"? Any help would be greatly appreciated. A |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Look like I figured it out.. pretty easy otherwise I wouldn't have
been able to get it Thanks. Sub Macro1() Dim r As Range Dim Rng As Range Set r = Range("AA22") Set Rng = Range("M:N") Do Rng.Sort _ Key1:=Range("N:N"), _ Order1:=xlAscending, _ Header:=xlYes, _ OrderCustom:=1, _ MatchCase:=False, _ Orientation:=xlTopToBottom Loop Until r = "MATCH" End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Have the need to sort text code-values within same Excel cell | Excel Worksheet Functions | |||
If a cell equals _, at the next row that equals _, return value fr | Excel Worksheet Functions | |||
If cell is left blank, or equals zero, then cell equals a different cell | Excel Discussion (Misc queries) | |||
if a:a (range) equals january and c:c equals gas then add g:g ($) | Excel Worksheet Functions | |||
custom filter does not work when selecting 'equals' X AND 'equals' | Excel Discussion (Misc queries) |