|
本帖最后由 westwenwei 于 2014-2-16 11:49 编辑
如何对每列数按要求进行筛查呢?谢谢了!还望各位大神不吝赐教,跪谢了!!!
本帖最后由 hwc2ycy 于 2014-2-16 12:23 编辑
- Sub test()
- Dim arr
- Dim result
- arr = Range("a8:v" & Range("a8").End(xlDown).Row).Value
- Dim i%
- Application.ScreenUpdating = False
- Rows("1:7").ClearContents
- For i = LBound(arr, 2) To UBound(arr, 2)
- result = getdata(arr, i)
- If UBound(result) <> -1 Then
- Cells(1, i).Resize(UBound(result) - LBound(result) + 1).Value = WorksheetFunction.Transpose(result)
- End If
- Next
- Application.ScreenUpdating = True
- MsgBox "完成", vbInformation
- End Sub
- Function getdata(arr, c1)
- Dim result
- Dim r1%
- Dim str$
- result = Array(0, 1, 2, 3, 4, 5, 6, 7)
- For r1 = LBound(arr) To UBound(arr)
- result(arr(r1, c1)) = r1 & "#"
- Next
- getdata = Filter(result, "#", false)
- End Function
复制代码方法二,用的filter函数实现。
|
|