|
- Sub 求对应数()
- '---------------------------------------------------------------------------------------
- ' Procedure : 求对应数
- ' Author : hwc2ycy
- ' Date : 2013/3/1
- ' Purpose : 数组遍历
- '---------------------------------------------------------------------------------------
- '
- Dim iLastRow As Long, i As Long, j As Long
- Dim arr
- Dim arrResult()
- Dim strTemp As String
- Application.ScreenUpdating = False
- iLastRow = Cells(Rows.Count, "x").End(xlUp).Row
- Range("y2:y" & iLastRow).Value = ""
- arr = Range("k1:u" & iLastRow).Value
- ReDim arrResult(1 To UBound(arr), 1 To 1)
- arrResult(1, 1) = "对应数"
- For i = LBound(arr) + 1 To UBound(arr)
- For j = LBound(arr, 2) To UBound(arr, 2)
- If arr(i, j) Like "[yY]" Then
- strTemp = strTemp & j - 1 & "、"
- End If
- Next
- arrResult(i, 1) = Left(strTemp, Len(strTemp) - 1)
- strTemp = ""
- Next
- Range("y1").Resize(iLastRow) = arrResult
- Columns("y").AutoFit
- Application.ScreenUpdating = True
- MsgBox "整理完毕", vbInformation + vbOKOnly
- End Sub
复制代码 |
|