|
こんな感じのことでしょうか。^d^
Sub test()
myFilter 特定の文字, 別の特定の文字
End Sub
Sub myFilter(項目 As String, 値 As String)
Dim rngDest As Range
Dim rngTitle As Range
Dim rngFind As Range
With ActiveSheet.UsedRange
.Worksheet.AutoFilterMode = False
Set rngTitle = .Rows(1)
Set rngFind = rngTitle.Find(項目, , xlValues, xlPart)
If rngFind Is Nothing Then Exit Sub
.AutoFilter rngFind.Column, "=*" & 値 & "*"
Set rngDest = Worksheets.Add.Range("A1")
rngTitle.Copy rngDest
Set rngDest = rngDest.Offset(1)
With .Offset(1).SpecialCells(xlCellTypeVisible)
.Copy rngDest
.Delete xlUp
End With
.Worksheet.AutoFilterMode = False
End With
End Sub
|
|