-6

Is there a way that I can get rid of .Select in the following code?

ActiveSheet.Range("$A$2:$AI$5000").AutoFilter Field:=3, Criteria1:="1"
Range("C3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.NumberFormat = "00"
ActiveSheet.Range("$A$2:$AI$5000").AutoFilter Field:=3
Range("A1").Select
CC268
  • 203
  • 3
  • 9
  • 2
    downvoted, because you did not research this before posting your question – jsotola Oct 20 '17 at 21:00
  • A question that covers lots of things on this matter: [How to avoid using Select in Excel VBA](https://stackoverflow.com/q/10714251/7690982). **EDIT**: Didn't see, but @SeanC already refered to this link. – danieltakeshi Oct 20 '17 at 22:37

1 Answers1

5

sure:

ActiveSheet.Range("$A$2:$AI$5000").AutoFilter Field:=3, Criteria1:="1"
Range(Range("C3"), Range("C3").End(xlDown)).NumberFormat = "00"
ActiveSheet.Range("$A$2:$AI$5000").AutoFilter Field:=3

See this for more details

SeanC
  • 15,695
  • 5
  • 45
  • 66
  • 5
    @CC268, such an easy question no doubt has tons of resources dedicated to it on the internet. The best way to learn is not to get other people to give you the answers. – CallumDA Oct 20 '17 at 20:26