|
ちょっとだけ改良。
Sub MyAlign()
Dim LR As Long
Dim C As Range
Dim St As String
Dim Ary As Variant
LR = Range("B65536").End(xlUp).Row
For Each C In Range("C1:D" & LR)
St = St & C.Value & ","
Next
Ary = WorksheetFunction.Transpose(Split(St, ","))
Application.ScreenUpdating = False
Range("D1").Value = 1
Range("D1:D" & LR).DataSeries xlColumns, , , 2
With Range("D" & LR + 1)
.Value = 2
.Resize(LR).DataSeries xlColumns, , , 2
End With
Range("A1").CurrentRegion.Sort Key1:=Range("D1"), _
Order1:=xlAscending, Header:=xlNo, Orientation:=xlSortColumns
Range("D:D").ClearContents
Range("C1").Resize(LR * 2).Value = Ary
Erase Ary
Application.ScreenUpdating = True
End Sub
|
|