| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 11294 | 2001-09-10 11:27:00 | Excel Macro | Guest (0) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 18587 | 2001-09-10 11:27:00 | I have a problem with a macro running auto filter. It appears that it will only accep a string in the criteria field. I would like to make drops down list or a cell reference available can you help. Below is a relevant section of the macro:- Range('c4:P4').Select Selection.AutoFilter Selection.AutoFilter Field:=3, Criteria1:=InputBox(prompt:='Party Number.') Range('c4').Select Range(Selection, ActiveCell.End(xlDown)).Select Selection.Copy |
Guest (0) | ||
| 18588 | 2001-09-11 02:03:00 | The following example shows using a range outside the table of data as a criteria to Autofilter. Field 3 is a column of dates and 'Start' and 'Finish' are range names of two cells containing dates. You could have the result of the InputBox placed in a range named cell then do the Autofilter. Adapt the code to suite. Sub setFilter() ' 'START' and 'FINISH' are range names containing dates - column 3 will be dates. Range('A2').Select Selection.AutoFilter Field:=3, Criteria1:=' & gt;=' & Range('START').Text, _ Operator:=xlAnd, _ Criteria2:=' & lt;=' & Range('FINISH').Text End Sub HTH |
Guest (0) | ||
| 1 | |||||