如果一行的开头有四个空格,则该行以固定大小的字体输出。这用于代码,但也允许您创建您所寻找的图像。我最好的猜测是你有这样的东西:
| A | B | C | D | E | F | G | H | I | J |
--+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
1 | A | B | C | | | | d | e | f | |
2 | | | | | | | | | | |
3 | | | | | | | | | | |
从这个起始位置,下面的代码创建:
| A | B | C | D | E | F | G | H | I | J |
--+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
1 | A | B | C | | | | d | e | f | |
2 | | | | | | | | | | |
3 | Ad | Ae | Af | Bd | Be | Bf | Cd | Ce | Cf | |
我的输出值与您的输出值不同,但不在您的规则列表中。
你说你有第一组值的三个版本,每个可能的序列中都有一个。你没有解释第二个和第三个版本的目的,所以我没有包括它们。
如果这不是您想要的,您必须对您的要求提供更完整的解释。
Option Explicit
Sub Permutate()
Dim ColDestCrnt As Long
Dim ColSrc1First As Long
Dim ColSrc1Crnt As Long
Dim ColSrc1Last As Long
Dim ColSrc2First As Long
Dim ColSrc2Crnt As Long
Dim ColSrc2Last As Long
Dim RowSrc1 As Long
Dim RowSrc2 As Long
Dim RowDest As Long
' Specify the position of the first set of source values
RowSrc1 = 1
ColSrc1First = 1 ' Column A
ColSrc1Last = 3 ' Column C
' Specify the position of the second set of source values
RowSrc2 = 1
ColSrc2First = 6 ' Column F
ColSrc2Last = 8 ' Column H
' Specify the start the destination
RowDest = 3
ColDestCrnt = 1
With Worksheets("Sheet1")
' Loop through first set of values and within that loop through
' the second set.
For ColSrc1Crnt = ColSrc1First To ColSrc1Last
For ColSrc2Crnt = ColSrc2First To ColSrc2Last
' Combine one value from the first set with one value in the second set.
.Cells(RowDest, ColDestCrnt).Value = _
.Cells(RowSrc1, ColSrc1Crnt).Value & _
.Cells(RowSrc2, ColSrc2Crnt).Value
ColDestCrnt = ColDestCrnt + 1
Next
Next
End With
End Sub