Need some macro help.

  • Thread starter Thread starter tweacle
  • Start date Start date
T

tweacle

have a macro that I keep getting a error on. Can anyone help.

The macro shown below.

Sub Macro2()
'
' Macro2 Macro
'

'
Columns("J:J").Select
Selection.AutoFilter
ActiveSheet.Range("$J$1:$J$330").AutoFilter Field:=1, Criteria1:=Array(
_
"Days", "From", "Hrs", "Off", "On", "To"), Operator:=xlFilterValues
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.ClearContents
Range("J1").Select
End Sub

Ive put into my workbook and comes up with run time error 1004 auto
method of range class failed.

Can anyone help. Im using office XP if that helps.

Thanks
 
When you do Data|Filter|Autofilter (in xl2003 and below), you get 2 criteria.
You can't cheat excel and try to use an array in code.

I'd insert a new column (K???) and use a formula like:
=or(j2={"Days", "From", "Hrs", "Off", "On", "To"})
Then drag down.

Then you could filter to show Trues.
 
Back
Top