ドキュメントに2枚(電話番号付き)があります。番号がsheet1に存在する場合、シート2から行を削除します。
もうすぐです(VBAを使用するのはこれが初めてです)。しかし、誰かが最後の部分で私を助けることができますか?
Sub CleanList()
Dim stopList As Range, cell1 As Range
Set stopList = Sheet1.Range("A1:A10000")
For Each cell1 In stopList
Dim fullList As Range, cell2 As Range
Set fullList = Sheet2.Range("A2:A10000")
For Each cell2 In fullList
If NumberFix(cell1.Value) = NumberFix(cell2.Value) Then
cell2.EntireRow.Delete
End If
Next cell2
Next cell1
End Sub
Private Function NumberFix(ByVal nr As String) As String
If Not nr.StartsWith("46") Then
nr = "46" + nr
End If
NumberFix = nr
End Function