目前实现的是对多组数据,如有 A,B,C,D,E,列。按从ABC开始,到ADE结束的顺序提取进行计算,首列始终有。现在想修改成:从ABC,到CDE,这样全排列提取计算。烦请帮忙对VBA中涉及这一块的规则修改下。感谢。
原来代码如下:
Dim i%, j%, k%, n%
n = 1
Application.Calculation = xlCalculationManual
Calculate
Sheet3.Range("C1:C10000").Value = Sheet4.Range("A1:A10000").Value
For i = 2 To Application.WorksheetFunction.CountA(Sheet4.Rows("1:1")) - 1
Sheet3.Range("D1:D10000").Value = Sheet4.Range(Sheet4.Cells(1, i), Sheet4.Cells(10000, i)).Value
For j = i + 1 To Application.WorksheetFunction.CountA(Sheet4.Rows("1:1"))
Sheet3.Range("E1:E10000").Value = Sheet4.Range(Sheet4.Cells(1, j), Sheet4.Cells(10000, j)).Value
Calculate
Application.Wait Now + TimeValue("0:00:01")
If Application.WorksheetFunction.CountBlank(Sheet2.Range("B2:Y25")) < 576 Then
For k = 2 To 25
If Application.WorksheetFunction.CountBlank(Sheet2.Range(Sheet2.Cells(k, "B"), Sheet2.Cells(k, "Y"))) < 24 Then
n = n + 1
Sheet1.Cells(n, 1).Value = Sheet3.Range("C1").Value & "-" & Sheet3.Range("D1").Value & "-" & Sheet3.Range("E1").Value
Sheet1.Cells(n, 2).Value = Sheet2.Cells(k, 1).Value
Sheet1.Range(Sheet1.Cells(n, "C"), Sheet1.Cells(n, "Z")).Value = Sheet2.Range(Sheet2.Cells(k, "B"), Sheet2.Cells(k, "Y")).Value
End If
Next k
End If
Next j
Next i
MsgBox "全部计算完成 !"
End Sub