我有一封电子邮件列表,范围从单元格C2:L1000。这些单元格中有些是空白的。某些单元格包含与其他单元格相同的电子邮件。我正在尝试在单个列中列出所有电子邮件的列表,以过滤掉重复值和空单元格。什么功能或VBA可以帮助我实现这一目标?
答案 0 :(得分:0)
这不是很有效,但是也许它将为您提供一些有关如何完成您想要的内容的想法。祝你好运
Sub RunThisCode()
Dim rcell As Range, Column2PlaceValues As Range, RangeOfEmailAddress As Range
Set Column2PlaceValues = Range("M:M").EntireColumn
Set RangeOfEmailAddress = Rangee("C2:L1000")
For Each rcell In RangeOfEmailAddress.Cells
If IsEmpty(rcell) Then
'do nothing
ElseIf Not (Test4Match(rcell, Column2PlaceValues)) Then
Cells(Rows.Count, Column2PlaceValues.Column).End(xlUp).Offset(1, 0) = rcell.Value
End If
Next rcell
End Sub
Private Function Test4Match(rcell As Range, Column2PlaceValues As Range) As Boolean
On Error GoTo NOPE
Test4Match = Application.WorksheetFunction.Match(rcell.Value, Column2PlaceValues, 0)
Exit Function
NOPE:
End Function