- Sub CSL()
- For y = 1 To 35
- If Cells(1, y) <> Sheet2.Cells(1, 1) And Cells(1, y) <> Sheet2.Cells(1, 2) And Cells(1, y) <> Sheet2.Cells(1, 3) And Cells(1, y) <> Sheet2.Cells(1, 4) And Cells(1, y) <> Sheet2.Cells(1, 5) And Cells(1, y) <> Sheet2.Cells(1, 6) And Cells(1, y) <> Sheet2.Cells(1, 7) And Cells(1, y) <> Sheet2.Cells(1, 8) Then
- If Cells(1, y) = "" Then
- y = 35
- Else
- Columns(y).Delete
- y = y - 1
- End If
- End If
- Next
- hs = Sheet1.UsedRange.Rows.Count
- For y1 = 1 To 8
- For x = 2 To hs
- If Cells(x, y1) <> Sheet2.Cells(1, 1) And Cells(x, y1) <> Sheet2.Cells(1, 2) And Cells(x, y1) <> Sheet2.Cells(1, 3) And Cells(x, y1) <> Sheet2.Cells(1, 4) And Cells(x, y1) <> Sheet2.Cells(1, 5) And Cells(x, y1) <> Sheet2.Cells(1, 6) And Cells(x, y1) <> Sheet2.Cells(1, 7) And Cells(x, y1) <> Sheet2.Cells(1, 8) Then
- If Cells(x, y1) = "" Then
- x = hs
- Else
- Range(Cells(x, y1), Cells(x, y1)).Select
- Selection.Delete Shift:=xlUp
- x = x - 1
- End If
- End If
- Next
- Next
- End Sub
复制代码 |