View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Is there a better way to do this?

Exactly what is the AutoFilter doing for you in this code? With the
exception of preserving the contents of Row 2 (from Columns B through I) and
providing drop down arrows in its cells, it looks like all your code is
doing is this...

ActiveSheet.Range("$B$3:$I$202").ClearContents

--
Rick (MVP - Excel)


"GoBow777" wrote in message
...

The macro below works fine but I was wondering is there a better way of
writing this without having to write 8 line items?

Sub ClearSheet2()
Application.ScreenUpdating = False
ActiveSheet.Range("$B$2:$I$202").AutoFilter Field:=1
ActiveSheet.Range("$B$2:$I$202").AutoFilter Field:=2
ActiveSheet.Range("$B$2:$I$202").AutoFilter Field:=3
ActiveSheet.Range("$B$2:$I$202").AutoFilter Field:=4
ActiveSheet.Range("$B$2:$I$202").AutoFilter Field:=5
ActiveSheet.Range("$B$2:$I$202").AutoFilter Field:=6
ActiveSheet.Range("$B$2:$I$202").AutoFilter Field:=7
ActiveSheet.Range("$B$2:$I$202").AutoFilter Field:=8
ActiveSheet.Range("$B$3:$I$202").Select
Selection.ClearContents
Range("A1").Select
End Sub

Matt




--
GoBow777