本帖最后由 gxl19870625 于 2015-5-14 18:06 编辑
先占个楼层,还没写完.- Sub test1()
- Dim arr, i As Integer, j As Integer, k As Integer, m&
- Sheets(1).Cells.Clear
- k = 1
- arr = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
- For i = 1 To 10
- For j = 1 To 10
- arr(i - 1) = ""
- arr(j - 1) = ""
- Sheets(1).Cells(k, 1).Resize(1, 10) = arr
- k = k + 1
- arr = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
- Next j
- Next i
-
- For m = 1 To Sheets(1).UsedRange.Rows.Count
- If Application.WorksheetFunction.CountBlank(Sheets(1).Range("A" & m & ":J" & m)) = 1 Then
- Sheets(1).Cells(m, "K") = 1
- End If
- Next m
-
- Sheets(1).Columns("K:K").AutoFilter Field:=1, Criteria1:="<>"
- Sheets(1).Columns("K:K").EntireRow.Delete
- Sheets(1).Range("A1:J" & Sheets(1).UsedRange.Rows.Count).SpecialCells(xlCellTypeBlanks).Delete Shift:=xlToLeft
- Sheets(1).UsedRange.RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5, 6, 7, 8), Header:=xlNo
- End Sub
复制代码
|