|
楼主 |
发表于 2023-6-28 14:58
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- arr = Sheet4.Cells(1, 1).CurrentRegion
-
- For c = 1 To UBound(arr, 2) - 2
- Sheet3.Cells(1, 3).Resize(UBound(arr), 1) = Application.WorksheetFunction.Index(arr, 0, c)
- For d = c + 1 To UBound(arr, 2) - 1
- Sheet3.Cells(1, 4).Resize(UBound(arr), 1) = Application.WorksheetFunction.Index(arr, 0, d)
- For e = d + 1 To UBound(arr, 2)
- Sheet3.Cells(1, 5).Resize(UBound(arr), 1) = Application.WorksheetFunction.Index(arr, 0, e)
-
- Calculate
-
- If Application.WorksheetFunction.CountBlank(Sheet2.Range("B2:B7")) < 6 Then
- For k = 2 To 7
- If Application.WorksheetFunction.CountBlank(Sheet2.Cells(k, "B")) < 1 Then
- n = n + 1
- Sheet1.Cells(n, 1).Value = Sheet3.Range("C1").Value & "-" & Sheet3.Range("D1").Value & "-" & Sheet3.Range("E1").Value
- Sheet1.Range(Sheet1.Cells(n, "B"), Sheet1.Cells(n, "AH")).Value = Sheet2.Range(Sheet2.Cells(k, "A"), Sheet2.Cells(k, "AG")).Value
- End If
- Next k
- End If
- Next e, d, c
-
- '后半部代码,arr = Sheet2.Cells(2, 1).CurrentRegion (行数不定,第2行起,列固定A:AG)。
- 'brr = Sheet1.Cells(2, 1).CurrentRegion .(行数不定,第2行起,列固定A:AH,)
- '判断arr中符合条件的数据先写入数组,最后结束时一次性写入BRR.
复制代码
再谢,根据你的启发,改写了上半部代码,测试速度没改善。估计问题在下半部代码里。可否请你再瞅一瞅。请看代码: |
|