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 5 years have passed since last update.

VBAそのままコピペ「オートフィルタ」

Last updated at Posted at 2019-07-26
Sub AutoFilter1()
'(設定)
 ActiveSheet.Range(Range("A1"), Cells(Rows.Count, "V").End(xlUp)).AutoFilter Field:=〇列目, Criteria1:="フィルタする文字列"
'(設定-不等号を使う場合)
ActiveSheet.Range(Range("A1"), Cells(Rows.Count, "V").End(xlUp)).AutoFilter Field:=〇列目, Criteria1:=">="&数値
'(操作文)

'(フィルタ解除)
Activesheet.ShowAllData

End Sub

関数化するなら(範囲の行、フィルタの列、検索文字)
Sub AutoFilter1(r as string,r2 as Long,w as string)
'(設定)
 ActiveSheet.Range(Range("A1"), Cells(Rows.Count, r).End(xlUp)).AutoFilter Field:=r2, Criteria1:=w

End Sub
呼び出し
call AutoFilter1(”行のアルファベット”,フィルタする行(数字),"フィルタする文字列")

'(結果を選択)
Range(Range("A2"), Cells(Rows.Count, "V").End(xlUp)).select
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?