#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,480
Default Rotating duty roster

Hi Al
For your 10 employee scenario
Initial setting
n = 5: m = 14: o = 17
each time through loop
n = n + 12: m = m + 12: o = o + 12

n is the starting row number, Employee 1
m is the last employee row number, Employee 10
o is the row number for the 1st Employee in the second week.

12 is the add-on each time (based upon 10 employees and 3 row interval 2
blank lines, 1 line of days)

so, for 5 employees change those 2 lines in the code to
n=5 : m=9 : o=12
n=n+7:m=m+7:o=o+7

--
Regards
Roger Govier



"gramps" wrote in message
...
Hi Roger
Sorry, I didn't explain what I meant properly. What I was wondering was
what
changes to make if it was only a 5 man rota but to still show 4 weeks at a
time.
Thanks again
--
Al
"Roger Govier" wrote:

Hi

Just change the size of the loop from 3 to 4
For i = 1 To 3


For i = 1 To 4
--
Regards
Roger Govier




Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$A$1" Then Exit Sub
Application.EnableEvents = False
Application.ScreenUpdating = False

Dim n As Long, m As Long, o As Long, i As Long
n = 5: m = 14: o = 17

For i = 1 To 3
Cells(m, 1).Select
Application.CutCopyMode = False
Selection.Cut
Cells(n, 1).Select
Selection.Insert Shift:=xlDown

Range(Cells(n, 1), Cells(m, 8)).Copy Cells(o, 1)
n = n + 12: m = m + 12: o = o + 12
Next i
Cells(m, 1).Select
Application.CutCopyMode = False
Selection.Cut
Cells(n, 1).Select
Selection.Insert Shift:=xlDown
Application.ScreenUpdating = False
Application.EnableEvents = True
End Sub


I hope this now resolves the problem.

--
Regards
Roger Govier



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stamp Duty Mr Stanley (UK) Excel Worksheet Functions 4 July 19th 06 11:49 AM
Please help with enclosed schedule of duty Huawei Excel Worksheet Functions 10 January 13th 06 02:46 PM
OT- Need to create an 11 & 12 man Duty Roster Gunjani Excel Worksheet Functions 0 May 20th 05 05:24 PM
How do i make doctor's duty rota in the hospital? dils New Users to Excel 1 March 25th 05 12:22 PM
How do I display daily duty timings (day/night) of employees for . R. Bhan Excel Discussion (Misc queries) 0 December 18th 04 11:33 PM


All times are GMT +1. The time now is 06:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"