以下文本为存放IP文件,每行一条,代码可检查IP总数及是否有重复。“合并后总数”是否等于“去重后总数”
Sub CheckIPNum()
On Error Resume Next
Dim arr
Dim j As Integer, all_num As Integer
all_num = 0
Set dic = CreateObject("scripting.dictionary")
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = True
'多选
.Filters.Clear
'清除文件过滤器
.Filters.add "Excel Files", "*.txt"
.Filters.add "All Files", "*.*"
'设置两个文件过滤器
Dim showOkCancel As Integer
showOkCancel = .Show
'FileDialog 对象的 Show 方法显示对话框,并且返回 -1(如果您按 OK)和 0(如果
您按 Cancel)。
If showOkCancel = -1 Then
For i = 1 To .SelectedItems.Count
' Debug.Print "您选择的