Function sort_sheet(sheet_name As String, sort_col As String, desk_flg As Boolean) As Integer
Dim sheet_name As String
Dim row_count As Integer
row_count = getRowCount() 'シートの行数を取得する↓参照
If desk_flg Then
Sheets(sheet_name).Range("A" & SHEET_OFFSET & ":" & COL_LIMIT_WATCH & row_count - 1).Sort _
Key1:=Sheets(sheet_name).Range(sort_col & SHEET_OFFSET), _
Order1:=xlDescending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
SortMethod:=xlPinYin
Else
Sheets(sheet_name).Range("A" & SHEET_OFFSET & ":" & COL_LIMIT_WATCH & row_count - 1).Sort _
Key1:=Sheets(sheet_name).Range(sort_col & SHEET_OFFSET), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
SortMethod:=xlPinYin
End If
End Function
シートの行数を取得する - 焼肉開発日記