martymartin
New Member
- Joined
- Jul 13, 2007
- Messages
- 6
Column A has a list of data (A,B,C, etc), I have created vb macro to autofilter on sheet DATA from worksheet A
Sub Extract_Data_A()
Sheets("DATA").Select
Range("A1").Select
Range("A2:S3000").Select
'Apply Autofilter
Selection.AutoFilter
FilterCriteria = "A"
'NOTE - this filter is on column N (field:=14), to change
'to a different column you need to change the field number
Selection.AutoFilter field:=17, Criteria1:=FilterCriteria
Range("A1").Select
Application.ScreenUpdating = True
End Sub
This works and I can assign this to a button, however, I would like the macro to take the value from Worksheet A of A1 (A) and use it as the filter so I do not have to create a macro for each one individually.
Any ideas?
Sub Extract_Data_A()
Sheets("DATA").Select
Range("A1").Select
Range("A2:S3000").Select
'Apply Autofilter
Selection.AutoFilter
FilterCriteria = "A"
'NOTE - this filter is on column N (field:=14), to change
'to a different column you need to change the field number
Selection.AutoFilter field:=17, Criteria1:=FilterCriteria
Range("A1").Select
Application.ScreenUpdating = True
End Sub
This works and I can assign this to a button, however, I would like the macro to take the value from Worksheet A of A1 (A) and use it as the filter so I do not have to create a macro for each one individually.
Any ideas?