|
目的是先删除最后2张sheet;删除每张sheet的第一行;然后根据日期降序排列;每张表删除链接相同的重复行。【 最后将每张sheet的日期替换成 product】这个功能我还没有实现
Sub learningexcel()
Dim Arr, Rng As Range, Sht As Worksheet, Dic As Object
Dim xRow, j, i As Integer
Sht(12, 13).Delete
For Each Sht In Worksheets
Sht.Columns("C:AH").Delete
Sht.Rows(1).Delete
With Sht
.Activate
Range("A:B").CurrentRegion.Sort Key1:=.Range("A1"), Order1:=xlDescending, Header:=xlGuess
End With
xRow = Range("B65536").End(xlUp).Row
For i = 2 To xRow
For j = i + 1 To xRow
If Cells(j, 2) = Cells(i, 2) Then
Range(Cells(j, 1), Cells(j, 256)).Rows.Delete
j = j - 1
xRow = xRow - 1
End If
Next
Next
Next
Application.DisplayAlerts = True
End Sub
|
|