|
楼主 |
发表于 2018-8-6 11:51
|
显示全部楼层
Sub lqxs()
Dim d, Arr, i&, xq, Sht As Worksheet
Set d = CreateObject("Scripting.dictionary")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each Sht In Sheets
If InStr(Sht.Name, "1357") Or InStr(Sht.Name, "246") Then Sht.Delete
Next
Sheets("半网").Activate
xq = Array("星期二", "星期四", "星期六")
For j = 0 To UBound(xq)
d(xq(j)) = ""
Next
Arr = [a1].CurrentRegion
Sheets("半网").coppy after:=Sheets(Sheets.Count)
With ActiveSheet
.Name = "半网1357"
For i = 32 To 2 Step -1
If d.exists(Arr(3, i)) Then
.Column(i).Delete
End If
Next
End With
Sheets("半网").Copy after:=Sheets(Sheets.Count)
With ActiveSheet
.Name = "半网246"
For i = 32 To 2 Step -1
If Not d.exists(Arr(3, i)) Then
.Column(i).Delete
End If
Next
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Sub lqxs()
Dim d, Arr, i&, xq, Sht As Worksheet
Set d = CreateObject("Scripting.dictionary")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each Sht In Sheets
If InStr(Sht.Name, "1357") Or InStr(Sht.Name, "246") Then Sht.Delete
Next
Sheets("半网").Activate
xq = Array("星期二", "星期四", "星期六")
For j = 0 To UBound(xq)
d(xq(j)) = ""
Next
Arr = [a1].CurrentRegion
Sheets("半网").coppy after:=Sheets(Sheets.Count)
With ActiveSheet
.Name = "半网1357"
For i = 32 To 2 Step -1
If d.exists(Arr(3, i)) Then
.Column(i).Delete
End If
Next
End With
Sheets("半网").Copy after:=Sheets(Sheets.Count)
With ActiveSheet
.Name = "半网246"
For i = 32 To 2 Step -1
If Not d.exists(Arr(3, i)) Then
.Column(i).Delete
End If
Next
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
|
|