| 
    
     |  | こんにちは。かみちゃん です。 
 >仕上がりは下表のように仕上げたいのですが
 >(オートフィルターをかけると、
 >例えば「交通費」の下に「交通費(製造)」の順になってしまいます)
 
 オートフィルタは関係ないと思うのですが、
 [#41519]で提示したコードに似ていますが、以下のような感じでできると思います。
 なお、1行目の最終列(提示の例ですとG列)の右隣の列を作業列として使います。
 
 Sub Macro2()
 Dim LastCell As Range
 Dim c As Range
 Dim cntBumon As Integer
 Dim ws1 As Worksheet
 
 Set ws1 = Sheets("Sheet1")
 
 ws1.Activate
 '最終列の決定
 cntBumon = Range("A1", Cells(1, Cells.Columns.Count).End(xlToLeft)).Columns.Count
 
 Set LastCell = Cells(Cells.Rows.Count, 1).End(xlUp)
 'ソートキーを作業列(最終列+1)に設定
 For Each c In Range("A2", LastCell)
 If Right(c.Value, 4) = "(製造)" Then
 c.Offset(, cntBumon).Value = Mid(c.Value, 1, Len(c.Value) - 4) & "0"
 Else
 c.Offset(, cntBumon).Value = c.Value & "1"
 End If
 Next
 '作業列をキーに並び替え
 Range("A1", LastCell).Resize(, cntBumon + 1).Sort Key1:=Cells(2, cntBumon + 1), Order1:=xlAscending, Header:= _
 xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
 SortMethod:=xlPinYin
 '作業列を消去
 Range("A1", LastCell).Offset(, cntBumon).ClearContents
 End Sub
 
 |  |