wordpress html调用php,手机优化大师下载,设计师培训多少,vps怎么做网站1. 目的
你是否在做一个表格排序#xff0c;但只能知道某几个行之间的相对顺序#xff0c;而可能排着排着发现后面还有顺序更靠前的项#xff0c;而不得不将排好的序号重新11…… 所以你需要一个宏#xff0c;它可以知道你输入了一个已经存在的序号#xff0c;并以那个序…1. 目的
你是否在做一个表格排序但只能知道某几个行之间的相对顺序而可能排着排着发现后面还有顺序更靠前的项而不得不将排好的序号重新11…… 所以你需要一个宏它可以知道你输入了一个已经存在的序号并以那个序号为准自动修改其他序号 举两个例子
原始修改修改后3334772211
原始修改修改后34457222311
2. 宏代码
Sub Worksheet_Change(ByVal Target As Range)If Not Intersect(Target, Target.Worksheet.Range(A:A)) Is Nothing ThenDim ws As WorksheetSet ws Target.WorksheetDim userInputRow As IntegeruserInputRow Target.RowDim userInputValue As IntegeruserInputValue Target.ValueDim i As IntegerDim lastRow As IntegerlastRow ws.Cells(ws.Rows.Count, A).End(xlUp).RowFor i 1 To lastRowIf i userInputRow ThenIf ws.Cells(i, 1).Value userInputValue Thenws.Cells(i, 1).Value userInputValue 1End IfEnd IfNext iEnd If
End Sub宏怎么用就不多说了这里是把排序列定为A列可以按需改