|
本帖最后由 yeminqiang 于 2016-6-5 11:23 编辑
- Sub cdsr()
- Dim arr, R&, C&, i&, j&, s, k%
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- arr = Sheet2.UsedRange
- Application.ScreenUpdating = False
- With Sheets("排程")
- For i = 2 To .Cells(Rows.Count, 1).End(xlUp).Row Step 10
- .Cells(i + 1, 1).Resize(9, 12).ClearContents
- Next
- End With
- On Error Resume Next '数据不规范,6T1、6T2所在的单元格有空格,已删除.但还是保留此代码
- For i = 4 To UBound(arr)
- For j = 7 To UBound(arr, 2)
- If arr(i, j) = "●" Then
- d(arr(2, j)) = d(arr(2, j)) + 1
- k = d(arr(2, j))
- s = Replace(arr(2, j), "T", "T-")
- R = Sheet1.UsedRange.Find(s).Row
- C = Sheet1.UsedRange.Find(s).Column
- If k <= 9 Then '注意K的值一定不能够大于18,即每个50T-2下面的18个空格一定要能够装满所有●标记的图号
- Sheet1.Cells(R, C).Offset(k, 0) = arr(i, 2)
- ElseIf k <= 18 Then
- Sheet1.Cells(R, C + 1).Offset(k - 9, 0) = arr(i, 2)
- End If
- End If
- Next
- Next
- Application.ScreenUpdating = True
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|