--- Greg Bowman <[EMAIL PROTECTED]> wrote:

> I'm using comparerows, and I can't even imagine how I'd add in
> the 
> second sort criteria.

Just break each cell into a number part and a string part. If the
numbers are different, sort by number.  If they're the same, sort
by the text part:

Function CompareRows(row1 As Integer, row2 As Integer, column As
Integer, ByRef result As Integer)

  Dim text1, text2, cell1, cell2 As String
  Dim num1, num2 As Integer
  
  cell1 = me.Cell(row1, column)
  cell2 = me.Cell(row2, column)
  
  num1 = val(cell1.Left(cell1.InStr(" ") - 1))
  num2 = val(cell2.Left(cell2.InStr(" ") - 1))
  
  text1 = cell1.Mid(cell1.InStr("("))
  text2 = cell2.mid(cell2.instr("("))
  
  // now for the comparison:
  // check the numbers first
  
  if num1 < num2 then
    result = -1
    return True
  end if
  
  if num1 > num2 then
    result = 1
    return True
  end if
  
  // if we get here, num1 = num2, so
  // compare based on text string
  
  if text1 < text2 then
    result = -1
    return True
  end if
  
  if text1 > text2 then
    result = 1
    Return True
  end if
  
  // otherwise they're equal
  result = 0
  return True
End Function

Mark Nutter

Quick and easy regex creation and debugging!
http://www.bucktailsoftware.com/products/regexplorer/


 
____________________________________________________________________________________
Sponsored Link

Mortgage rates near 39yr lows. 
$420k for $1,399/mo. Calculate new payment! 
www.LowerMyBills.com/lre
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to