2017-08-24 11 views
0
DoEvents 

Dim lastrow As Long 
lastrow = Cells(Rows.Count, 2).End(xlUp).Row 
Range("A3:H" & lastrow).Sort key1:=Range("H3:H" & lastrow), _ 
order1:=xlAscending, Header:=xlNo 

テーブルを行Hの日付で並べ替えると、「実行時エラー '1004':RangeクラスのSortメソッドが失敗しました」というエラーメッセージが表示され、コードの最後の行事前のおかげでVBA複数行の並べ替え

+0

lastrow = Cells(Rows.Count, 8).End(xlUp).Rowに変更してみてください:) – Sixthsense

答えて

0

それは私のために罰金を働いてlastrow = Cells(Rows.Count, 2).End(xlUp).Row