DoEvents
Dim lastrow As Long
lastrow = Cells(Rows.Count, 2).End(xlUp).Row
Range("A3:H" & lastrow).Sort key1:=Range("H3:H" & lastrow), _
order1:=xlAscending, Header:=xlNo
我想按行H中的日期对表进行排序,但它给出了错误消息“运行时错误'1004':Range类的排序方法失败”,它指向最后一行代码。提前致谢
答案 0 :(得分:0)
尝试将lastrow = Cells(Rows.Count, 2).End(xlUp).Row
更改为lastrow = Cells(Rows.Count, 8).End(xlUp).Row