Показать сообщение отдельно

  #7  
Старый 09.09.2009, 22:19
Pashkela
Динозавр
Регистрация: 10.01.2008
Сообщений: 2,841
С нами: 9649706

Репутация: 3338


По умолчанию

Одну строчку сам не мог догадаться вставить чтоли?

PHP код:
Const intDataCol1 = 1       ' Номер столбца с кодами
Const intDataCol2 = 3       ' 
Номер столбца с ценами
Const intMaxRow = 12700    '  Номер последней строки в таблице
    Dim i%, j%
    Dim strValue1$, strValue2$, strValue3$, strValue4$
    For i = 2 To intMaxRow - 1
        strValue1 = Trim(Cells(i, intDataCol1))
        strValue3 = Trim(Cells(i, intDataCol2))
        If strValue1 = "" Then i = intMaxRow ' 
Волшебная строчка
          
For j = i + 1 To intMaxRow
              strValue2 
= Trim(Cells(j, intDataCol1))
              
strValue4 = Trim(Cells(j, intDataCol2))
              If 
StrComp(strValue1, strValue2, vbTextCompare) = 0 Then
                  
If strValue3 > strValue4 Then
                      Rows
(j & ":" & j).Select
                      Selection
.Delete Shift:=xlUp
                  
Else
                      
Rows(i & ":" & i).Select
                      Selection
.Delete Shift:=xlUp
                  End 
If
              
End If
          
Next
    Next 
 
Ответить с цитированием