• 締切済み

実行するとどうなるのでしょうか?

Private Sub CommandButton1_Click() Dim a, rng As Range, n As Long On Error GoTo Last Set rng = Application.InputBox("A1:I29", Type:=8) If Not rng Is Nothing Then Exit Sub On Error GoTo 0 a = rng.Value ReDim Preserve a(1 To rng.Rows.Count, 1 To rng.Columns.Count + 1) For i = 2 To UBound(a, 1) If IsEmpty(a(i, 2)) Then n = 0 Do While IsEmpty(a(i + n, 2)) a(i + n, UBound(a, 2)) = a(i - 1, 2) & ";" & n n = n + 1 Loop End If Next VSortMA a, 2, UBound(a, 1), UBound(a, 2) rng.Value = a Erase a Last: End Sub Private Sub VSortMA(ary, LB, UB, ref) Dim M As Variant, temp i As Long, ii As Long, iii As Long i = UB: ii = LB M = ary(Int((LB + UB) / 2), ref) Do While ii <= i Do While ary(ii, ref) < M ii = ii + 1 Loop Do While ary(i, ref) > M i = i - 1 Loop If ii <= i Then For iii = LBound(ary, 2) To UBound(ary, 2) temp = ary(ii, iii): ary(ii, iii) = ary(i, iii): ary(i, iii) = temp Next ii = ii + 1: i = i - 1 End If Loop If LB < i Then VSortMA ary, LB, i, ref If ii < UB Then VSortMA ary, ii, UB, ref End Sub

みんなの回答

回答No.1

実行してみりゃいいじゃん(笑)

関連するQ&A