Sub PROVERKA() Dim nResult As Integer Dim iCell As Range Dim iCellp As Range Dim code As String Dim codep As String Dim i As Long Dim j As Long Dim i1 As Long Dim ij As Long
Dim LastRow As Long, r As Long LastRow = ActiveSheet.UsedRange.Rows.Count LastRow = LastRow + ActiveSheet.UsedRange.Row - 1
For i = 1 To LastRow For j = 1 To 1 Range(Cells(i, j), Cells(i, j)).Select code = ActiveCell.Cells.Value If code <> "" Then For i1 = i To LastRow For j1 = 1 To 1 Range(Cells(i1, j1), Cells(i1, j1)).Select codep = ActiveCell.Cells.Value If codep = code And (i <> i1 Or j <> j1) Then Range(Cells(i, 3 + j), Cells(i, 3 + j)).Select ActiveCell.FormulaR1C1 = "DUBL" Range(Cells(i1, 3 + j), Cells(i1, 3 + j)).Select ActiveCell.FormulaR1C1 = "DUBL" Range(Cells(1, 11), Cells(1, 11)).Select ActiveCell.FormulaR1C1 = "DUBL!!!" End If Next j1 Next i1 End If Next j Next i
End Sub
это макрос. For i = 1 To LastRow - с первой строки до последней For j = 1 To 1 - только по графе А проверка ( 1 To 2 - А и В например) если найден дубль - в графе С в этой строке будет отмета DUBL
no subject
Date: 2012-10-03 11:55 am (UTC)Dim nResult As Integer
Dim iCell As Range
Dim iCellp As Range
Dim code As String
Dim codep As String
Dim i As Long
Dim j As Long
Dim i1 As Long
Dim ij As Long
Dim LastRow As Long, r As Long
LastRow = ActiveSheet.UsedRange.Rows.Count
LastRow = LastRow + ActiveSheet.UsedRange.Row - 1
For i = 1 To LastRow
For j = 1 To 1
Range(Cells(i, j), Cells(i, j)).Select
code = ActiveCell.Cells.Value
If code <> "" Then
For i1 = i To LastRow
For j1 = 1 To 1
Range(Cells(i1, j1), Cells(i1, j1)).Select
codep = ActiveCell.Cells.Value
If codep = code And (i <> i1 Or j <> j1) Then
Range(Cells(i, 3 + j), Cells(i, 3 + j)).Select
ActiveCell.FormulaR1C1 = "DUBL"
Range(Cells(i1, 3 + j), Cells(i1, 3 + j)).Select
ActiveCell.FormulaR1C1 = "DUBL"
Range(Cells(1, 11), Cells(1, 11)).Select
ActiveCell.FormulaR1C1 = "DUBL!!!"
End If
Next j1
Next i1
End If
Next j
Next i
End Sub
это макрос.
For i = 1 To LastRow - с первой строки до последней
For j = 1 To 1 - только по графе А проверка ( 1 To 2 - А и В например)
если найден дубль - в графе С в этой строке будет отмета DUBL
как-то так