回覆列表
  • 1 # daazhu1

    需用宏來完成,三步走:

    1.alt+F11

    2.雙擊左邊工程框裡的Sheet1,右邊的編輯視窗中輸入以下程式碼:

    Sub SuperSort()

    Dim i As Integer

    Dim j As Integer

    Dim arry(3) As Integer

    arry(1) = Cells(1, 1).Value

    For i = 1 To arry(1)

    If i = 1 Then

    Cells(i, 2) = 100

    Else

    Cells(i, 2).Value = Cells(i - 1, 2).Value + 1

    End If

    Next

    For i = 2 To 3

    arry(i) = arry(i - 1) + Cells(i, 1).Value

    Cells(arry(i - 1) + 1, 2).Value = Cells(arry(i - 1), 2).Value

    For j = arry(i - 1) + 2 To arry(i)

    Cells(j, 2).Value = Cells(j - 1, 2).Value + 1

    Next

    Next

    End Sub

    3.F5

    即可

    注:如果不只三個數字,可把arry(3),3,兩處改為相應的個數。還有疑問:[email protected]

  • 中秋節和大豐收的關聯?
  • 進出口貨物的通關環節有哪些?