View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
addy addy is offline
external usenet poster
 
Posts: 10
Default Looping Help Required

I did come up with a change in the above code but I need to know he errors I
am making and probably some solution to that error


Dim Sectx As Integer
Dim Secty As Integer
Sectx = 1
Do
Secty = 1
Do

'I am getting an error on this line, what this code does is that it
changes
'selection of cell from A2, A22,A42,A82,A102....so on
Set curcell = Worksheets("Arranged Data1").Cells((((Sectx - 1) * 40)
+ ((sety - 1) * 20) + 2), 1)
Sheets("Unarranged Data").Select
Application.CutCopyMode = False
'Filters using conditions 1:1, 1:2...1:40,
2:1,2:2...2:40,...,9:1....9:40
Selection.AutoFilter Field:=6, Criteria1:=(Sectx & ":" & Secty)
Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Arranged Data1").Select
ActiveSheet.Paste

Secty = Secty + 1
Loop While Secty = 40

Sectx = Sectx + 1
Loop While Sectx = 9