當前位置:生活全書館 >

IT科技

> excel隨內容改變自動排序

excel隨內容改變自動排序

第一步:把文件另存為“EXCEL 啟用巨集的工作簿”。

excel隨內容改變自動排序

第二步:依次點選檢視-巨集-錄製巨集-輸入巨集名。

excel隨內容改變自動排序 第2張

excel隨內容改變自動排序 第3張

第三步:選中需要排序的區域-開始-排序和篩選-自定義排序-按照需要設定排序規則

excel隨內容改變自動排序 第4張

excel隨內容改變自動排序 第5張

第四步:檢視-巨集-停止錄製。

excel隨內容改變自動排序 第6張

第五步:編輯程式碼

sheel1右鍵-檢視程式碼-複製貼上程式碼-儲存-關閉程式碼編輯

說明:“1”和“7”為行序號,“1”和“5”為列序號,“自動排序”為巨集名,根據需要自行修改

程式碼:

Private Sub Worksheet_Change(ByVal Target As Range)    If (Target.Row >= 1) Then

    If (Target.Row <= 7) Then

    If ((Target.Column >= 1)) Then

    If ((Target.Column <= 5)) Then        自動排序    End If    End If

    End If    End IfEnd Sub

excel隨內容改變自動排序 第7張

excel隨內容改變自動排序 第8張

第六步:完成了,試下該數值吧!

excel隨內容改變自動排序 第9張

以上便是針對該問題所整理出來的具體操作步驟,希望可以幫助到需要的朋友。

標籤: excel 自動
  • 文章版權屬於文章作者所有,轉載請註明 https://shqsg.com/dianzi/93pqp9.html