No.6-域名整理vba
'域名复制单元格(D-E)有值复制 为空复制C-E
Sub Macro1()
x = Cells(Rows.Count, 1).End(xlUp).Row + 1
For i = 1 To X
If Len(Range("D" & i)) <> 0 Then
If Len(Range("E" & i)) = 0 Then
Range("D" & i).Select
Selection.Cut
Range("E" & i).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End If
Else: Range("C" & i).Select
Selection.Cut
Range("E" & i).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End If
Next
Columns("B:B").Select
Selection.Replace What:="www", Replacement:="", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
'整合单元格 B=B+C 即:组合为原来的域名
Dim s, t
x = Cells(Rows.Count, 1).End(xlUp).Row + 1
For i = 1 To x
If Len(Range("B" & i)) = 0 Then
Range("C" & i).Select
Selection.Cut
Range("B" & i).Select
ActiveSheet.Paste
Application.CutCopyMode = False
ElseIf Len(Range("B" & i)) <> 0 Then
s = Range("C" & i).Value
t = Range("B" & i).Value & "." & s
Range("B" & i).Clear
Range("B" & i) = t
End If
Next
End Sub

浙公网安备 33010602011771号