我在排序方面遇到问题 是不是正确排序,筛选只是第一个数字? 用于查找数字和插入数据的此解决方案或其他解决方案的任何解决方案?
答案 0 :(得分:0)
试试这个:
' Workbuuk
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets(1)
' Our used range
Dim rng As Range
Set rng = ws.UsedRange
Dim rngCell As Range ' cellie
' Mad Max
Dim lngMaxRow As Long
lngMaxRow = Range("B" & Rows.Count).End(xlUp).Row
' The heat is on
For Each rngCell In rng.Range("B1:B" & lngMaxRow)
' set a value to the left, to the left
rngCell.Offset(0, -1).Value = Left(rngCell.Value, InStr(1, rngCell.Value, ".") - 1)
Next
' Sort on A, A, A . . . . under my umbrella, A, A, A, A-A
rng.Sort KeY1:=Range("A2"), Order1:=xlAscending
' The heat is off
For Each rngCell In rng.Range("B1:B" & lngMaxRow)
' Undo weah
rngCell.Offset(0, -1).Value = ""
Next
假设: