EXCEL怎么自动排序

excel

1个回答

写回答

18676181873

2025-12-21 23:50

+ 关注

LG
LG

这用代码很好解决 在你的工作表名称那里——右键——查看代码 把下面的代码全部复制进去,就可以了 Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 Then '当A列的数据有改变时 i = Selection.Row j = Selection.Column Columns(A:A).Select '选中你要排序的列,这是A列,如是是ABC三列,则换为A:C Selection.Sort Key1:=Range(A1), Order1:=xlDescending, Header:=xLGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _ :=xlPinYin, D抗游住ataOption1:=xlSortNormal 'Key1:=Range(A1), 表示用A列进行排序 Cells(i直士, j).Select End If End Sub '这是你输入一个数,按回车后,自动排序,然后把光标移到下一个单元格

举报有用(0分享收藏

Copyright © 2025 IZhiDa.com All Rights Reserved.

知答 版权所有 粤ICP备2023042255号