View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
James T James T is offline
external usenet poster
 
Posts: 14
Default Error 400 on running Macro

I have created a little macro that:

1) Goes to a specific sheet;
2) Unhides a certain range of cells;

This small macro works well for me.

Coding is:

Sub Yr1unhide()
Sheets("Data").Select
Application.Goto Reference:="Year1"
Selection.EntireColumn.Hidden = False
End Sub

However I then tried to add in a filter so that only rows that have a value
of "1" in the filter column (ES) are shown. But now when I run the macro a
error box pops up with a value of 400 in it, and no other information.

Sub Yr1unhide()
Sheets("Data").Select
Application.Goto Reference:="Year1"
Selection.EntireColumn.Hidden = False
Range("ES2").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=1", Operator:=xlAnd
End Sub

Can anyone help?
Regards

James