我使用'user3598756'幫助下面的代碼。 代碼指示最小銷售值並指示供應商名稱(一個名稱一列)。 我需要按數字順序排列數值,前十位,後9位等等,最小值爲5. 還需要在一個單元格中僅獲取供應商的第一個姓氏。最小值的訂單值e從供應商處得到姓氏和名字
現在是這樣的: https://i.imgsafe.org/8f0c36ee2b.jpg
代碼:
Option Explicit
Sub best()
Dim copyrow As Long
Dim helpRng As Range
copyrow = 30
With Worksheets("Resumo")
With .Range("J11:J47")
Set helpRng = .Offset(, .Parent.UsedRange.Columns.Count)
helpRng.Value = .Value
helpRng.Offset(, 1).Value = .Offset(, -7).Value
Set helpRng = helpRng.Resize(.Rows.Count + 1, 2).Offset(-1)
End With
End With
With helpRng
.Cells(1, 1).Resize(, 2) = "header"
.Sort key1:=helpRng, order1:=xlAscending, Header:=xlYes
.AutoFilter field:=1, Criteria1:=">0"
If Application.WorksheetFunction.Subtotal(103, .Resize(, 1)) > 1 Then
Worksheets("os melhores").Cells(copyrow, "F").Resize(5, 2).Value = .Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).Resize(5).Value
Worksheets("os melhores").Cells(copyrow, "G").Resize(5).TextToColumns DataType:=xlDelimited, ConsecutiveDelimiter:=True, Space:=True
End If
.Parent.AutoFilterMode = False
.ClearContents
End With
End Sub
我還沒有這個必要的技能來管理做到這一點。 在此先感謝!
顯示輸出多麼渴望應該再次 – user3598756