回覆列表
  • 1 # 使用者8451710051916

    程式碼如下:

    Option Explicit

    Sub YgB()

    Dim arr, i, i2, j, k, m, n, c As Range

    arr = Selection

    i = Selection.Cells(1, 1).Row

    j = Selection.Cells(1, 1).Column

    n = 0

    For k = 1 To UBound(arr)

    If n 0 Then

    If arr(k, 1) > n + 1 Then

    Cells(i2, 1).Resize(arr(k, 1) - n - 1, 1).EntireRow.Insert

    For Each c In Cells(i2, 1).Resize(arr(k, 1) - n - 1, 1).Cells

    n = n + 1

    c.Value = n

    i2 = i2 + 1

    Next c

    End If

    i2 = i2 + 1

    Else

    i2 = i + k

    End If

    n = arr(k, 1)

    Next k

    End Sub

    執行的拷屏如下:

  • 中秋節和大豐收的關聯?
  • 面對汽油、柴油價格暴漲,你是否贊成力挺價廉質優的民油?