View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default complex looping problem

Hi Max,


"Max Bialystock" wrote in message
...
Hi Bob,
Sorry to trouble you again.

Run like as amended below it works perfectly.

If the array is expanded to include 5 6 7 8 whatever happens to sheet 8
happens to each sheet.

What I need to happen is that the data in row 4 of sheet 1 winds up in

sheet
4 and the data in row 5 of sheet 1 in sheet 5 and so on.

If you've had enough of this now, I'll understand.


Get out of here! We'll crack it.

The biggest difficulty I have is envisaging eaxctly what you arev trying to
do, as I obviously don't have the data or the requirements as you know them.

Having said that, the Weeks procedure looks wrong. Try this variation and
let me know.

Sub Weeks(x As Long, sh As Worksheet)
Dim r As Long 'this points to the worksheet row
Dim c As Long 'this points to the array column, not the worksheet column
Dim SheetValues As Variant

With Worksheets(1)
SheetValues = .Range(.Cells(x, 2), .Cells(x, 8)).Resize(1, 7).Value
WeekNum 7, 1, 13, SheetValues, sh
SheetValues = .Range(.Cells(x, 9), .Cells(x, 15)).Resize(1, 7).Value
WeekNum 17, 1, 23, SheetValues, sh
End With

End Sub