✔ 最佳答案
If Cells(1, 1) = 1 Then
Cells(1, 3) = "A"
Else
Cells(1, 3) = "B"
End If
x = 1
y = 3
For i = 2 To [A65536].End(3).Row
If Cells(i, 1) = 1 Then
Rx = "A"
Else
Rx = "B"
End If
If Cells(i, 1) = Cells(i - 1, 1) Then
Cells(x + 1, y) = Rx
x = x + 1
Else
y = y + 1
Cells(1, y) = Rx
x = 1
End If
Next