當前位置:編程學習大全網 - 網站源碼 - 求寫excel vb代碼

求寫excel vb代碼

Sub Macro1()

Columns("A:A").Select

Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _

OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _

:=xlPinYin, DataOption1:=xlSortNormal

Dim i As Long

i = 1

Do While Cells(i, 1) <> ""

If Cells(i + 1, 1) = "" Then

Cells(i, 1) = Cells(i, 1) - 15

i = i + 1

ElseIf Cells(i + 1, 1) - Cells(i, 1) < 11 Then

Cells(i + 1, 1) = Cells(i + 1, 1) - 20

Cells(i, 1) = Cells(i, 1) - 10

i = i + 2

Else

Cells(i, 1) = Cells(i, 1) - 15

i = i + 1

End If

Loop

End Sub

  • 上一篇:源導入無法運行。
  • 下一篇:小豬電商小程序系統開發功能亮點
  • copyright 2024編程學習大全網