vasiliy74
Что-то вроде этого:
Код:
Private Sub CommandButton1_Click()
Dim in_r As Range, out_r As Range
Dim index As Long, found As Boolean
Dim c1 As Variant, c2 As Variant
index = 1
' Входной диапазон на листе со внешним именем "Лист1" A:A
Set in_r = Worksheets("Лист1").Range("A:A")
' Выходной диапазон на листе со внешним именем "Лист1" B:B
Set out_r = Worksheets("Лист1").Range("B:B")
For Each c1 In in_r.Cells
found = False
For Each c2 In out_r.Cells
If IsEmpty(c2) Then Exit For
found = (c2.Value = c1.Value)
If found Then Exit For
Next c2
If Not found Then
out_r.Cells(index, 1).Value = c1.Value
index = index + 1
End If
If IsEmpty(c1) Then Exit For
Next c1
MsgBox "Done", vbInformation
End Sub
Что-то вроде этого:
Код:
Private Sub CommandButton1_Click()
Dim in_r As Range, out_r As Range
Dim index As Long, found As Boolean
Dim c1 As Variant, c2 As Variant
index = 1
' Входной диапазон на листе со внешним именем "Лист1" A:A
Set in_r = Worksheets("Лист1").Range("A:A")
' Выходной диапазон на листе со внешним именем "Лист1" B:B
Set out_r = Worksheets("Лист1").Range("B:B")
For Each c1 In in_r.Cells
found = False
For Each c2 In out_r.Cells
If IsEmpty(c2) Then Exit For
found = (c2.Value = c1.Value)
If found Then Exit For
Next c2
If Not found Then
out_r.Cells(index, 1).Value = c1.Value
index = index + 1
End If
If IsEmpty(c1) Then Exit For
Next c1
MsgBox "Done", vbInformation
End Sub