
07.09.2009, 17:08
|
|
Динозавр
Регистрация: 10.01.2008
Сообщений: 2,841
Провел на форуме: 9220514
Репутация:
3338
|
|
максрос:
PHP код:
Sub Макрос1()
Const intDataCol1 = 1 ' Номер столбца с кодами
Const intDataCol2 = 3 ' Номер столбца с ценами
Const intDataCol3 = 2 ' Номер столбца со странами
Const intMaxRow = 6 ' Номер последней строки в таблице
Dim i%, j%
Dim strValue1$, strValue2$, strValue3$, strValue4$, strValue5$, strValue6$
For i = 2 To intMaxRow - 1
strValue1 = Trim(Cells(i, intDataCol1))
strValue3 = Trim(Cells(i, intDataCol2))
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
Cells(j, intDataCol1).Delete shift:=xlUp
Cells(j, intDataCol2).Delete shift:=xlUp
Cells(j, intDataCol3).Delete shift:=xlUp
Else
Cells(i, intDataCol1).Delete shift:=xlUp
Cells(i, intDataCol2).Delete shift:=xlUp
Cells(i, intDataCol3).Delete shift:=xlUp
End If
End If
Next
Next
End Sub
Последний раз редактировалось Pashkela; 07.09.2009 в 17:18..
|
|
|