首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >在尝试对数据进行排序时,如何克服运行时错误'1004‘?

在尝试对数据进行排序时,如何克服运行时错误'1004‘?
EN

Stack Overflow用户
提问于 2019-06-21 01:12:04
回答 1查看 57关注 0票数 0

我正在过滤一大组数据。作为该过程的一部分,我尝试在给定特定条件的情况下按升序或降序对单元格范围进行排序。

我研究了一些关于如何排序的选项。我正在努力理解这些参数。

代码语言:javascript
复制
If Abs(Worksheets("Points").Cells(i, 4).Value - Worksheets("Points").Cells(i - 1, 5).Value) > _
Abs(Worksheets("Points").Cells(j + 1, 4).Value - Worksheets("Points").Cells(i, 5).Value) Then
    'Test to see whether logically the User moved from
    'the previous Sensors to the time stamp Sensors (Decending) or
    'from the time stamp Sensors to the next Sensor (Acending).
    'This If is used to determine whether sorting must happen
    'in an Acending or Decending order
    'Time MUST be in date format!!!!!

    Worksheets("Trips").Range(Cells(1, 23), Cells(k, 27)).Sort _
    Key1:=Worksheets("Trips").Range(Cells(1, 27)), Order1:=xlDescending, Header:=xlNo
Else
    Worksheets("Trips").Range(Cells(1, 23), Cells(k, 27)).Sort _
    Key1:=Worksheets("Trips").Range(Cells(1, 27)), Order1:=xlAscending, Header:=xlNo
End If
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56690885

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档