0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VBA エクセル 売上のカラムで降順(値が大きい順)で並び替える

Posted at

1.jpg

2.jpg

Sub uriage()
    Range("I4").Select 'I4セルをセレクト
    ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear '前のSortFieldオブジェクト削除
    ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("I4"), _
        SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Sheet1").Sort
        .SetRange Range("A3:I8")
        .Header = xlGuess
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
End Sub

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?