View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
leimst leimst is offline
external usenet poster
 
Posts: 34
Default How does this work?

Can anyone interpret this code for me to explain the logic in how it works.
I've run it and can see the results but I still don't understand the logic
used that makes this small amount of code do so much!

Sub x()

Dim c As Long

With Sheet1
.AutoFilterMode = False
For c = 3 To .Cells(1, 1).End(xlToRight).Column
.Range("A1").AutoFilter Field:=c, Criteria1:="X"
Sheets.Add(after:=Sheets(Sheets.Count)).Name = Left(.Cells(1,
c), 31)
.AutoFilter.Range.Resize(, 2).Copy ActiveSheet.Range("A1")
.ShowAllData
Next c
.AutoFilterMode = False
End With

End Sub

Thanks,

Brian