|
供参考
- Sub 增加()
- Dim se As Boolean
- Dim ws As Worksheet
- For Each ws In Worksheets
- If ws.Name = "结果" Then
- se = True
- Exit For
- End If
- Next ws
-
- If se Then
- Application.DisplayAlerts = False
- Sheets("结果").Delete
- Application.DisplayAlerts = True
- End If
-
- Sheets("Sheet1").Copy After:=Sheets(Sheets.Count)
- ActiveSheet.Name = "结果"
-
- With Sheets("结果")
- .Columns("D").NumberFormat = "@"
- .Columns("D").ColumnWidth = 25
-
- Dim last1 As Long
- last1 = Sheets("结果").Cells(Rows.Count, 1).End(xlUp).Row
- Dim last2 As Long
- last2 = Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row
-
- Dim i As Long
- For i = 1 To last1
- Dim sv As String
- sv = Sheets("结果").Cells(i, 1).Value
- Dim j As Long
- For j = 1 To last2
- If Sheets("Sheet2").Cells(j, 1).Value = sv Then
- Sheets("结果").Cells(i, 4).Value = Sheets("Sheet2").Cells(j, 2).Value
- Sheets("结果").Cells(i, 5).Value = Sheets("Sheet2").Cells(j, 3).Value
- Sheets("结果").Cells(i, 6).Value = Sheets("Sheet2").Cells(j, 4).Value
- Exit For
- End If
- Next j
- Next i
- End With
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|