View Single Post
  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default how can i enter names on a calender and let it auto sequence

Not automatic as I know nothing about your calendar, but the following
simple macro will insert a rotated overtime pattern shown at the start, for
the selected month, at the cursor.
http://www.gmayor.com/installing_macro.htm
The macro is easily edited if I have misunderstood your rotation pattern.

Sub Overtime()
'January Bob Mike Troy
'February Sue Bob Brad
'March Mike Sue Troy
'April Bob Mike Brad
'May Sue Bob Troy
'June Mike Sue Brad
'July Bob Mike Troy
'August Sue Bob Brad
'September Mike Sue Troy
'October Bob Mike Brad
'November Sue Bob Troy
'December Mike Sue Brad

Dim strMonth As String
Dim strText As String
Dim strFirst As String
Dim strSecond As String
Dim strThird As String

Start:
strMonth = InputBox("Enter Month Number - 1 to 12", _
"Month", Format(Date, "M"))
If strMonth = "" Then GoTo Cancelled:

If strMonth 12 Then
MsgBox "There are only 12 months in a year!", vbExclamation, "Month"
GoTo Start:
End If

If strMonth = 1 Then
strFirst = "Bob"
strSecond = "Mike"
strThird = "Troy"
End If

If strMonth = 2 Then
strFirst = "Sue"
strSecond = "Bob"
strThird = "Brad"
End If

If strMonth = 3 Then
strFirst = "Mike"
strSecond = "Sue"
strThird = "Troy"
End If

If strMonth = 4 Then
strFirst = "Bob"
strSecond = "Mike"
strThird = "Brad"
End If

If strMonth = 5 Then
strFirst = "Sue"
strSecond = "Bob"
strThird = "Troy"
End If

If strMonth = 6 Then
strFirst = "Mike"
strSecond = "Sue"
strThird = "Brad"
End If

If strMonth = 7 Then
strFirst = "Bob"
strSecond = "Mike"
strThird = "Troy"
End If

If strMonth = 8 Then
strFirst = "Sue"
strSecond = "Bob"
strThird = "Brad"
End If

If strMonth = 9 Then
strFirst = "Mike"
strSecond = "Sue"
strThird = "Troy"
End If

If strMonth = 10 Then
strFirst = "Bob"
strSecond = "Mike"
strThird = "Brad"
End If

If strMonth = 11 Then
strFirst = "Sue"
strSecond = "Bob"
strThird = "Troy"
End If

If strMonth = 12 Then
strFirst = "Mike"
strSecond = "Sue"
strThird = "Brad"
End If

strText = "First Shift: " & vbTab & strFirst & _
vbCr & "Second Shift: " & vbTab & strSecond & _
vbCr & "Third Shift: " & vbTab & strThird

With Selection
.Font.Bold = True
.Font.Underline = wdUnderlineSingle
.TypeText Text:="OVERTIME"
.TypeParagraph
.Font.Bold = False
.Font.Underline = wdUnderlineNone
.TypeText strText
End With
Exit Sub
Cancelled:
MsgBox "User Cancelled!", vbInformation, "Cancelled"
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


TW wrote:
i have five names i need to enter to work overtime for every month of
the year is there a way that i can enter the names and word will
automatically enter them in the calender and make sure that it is
evenly distributed? ex: i have bob,sue,mike,troy,and brad.
bob/sue/mike are to be rotated between 1st and 2nd shift troy and
brad only needs to be rotated between third shift. is there a way i
can do this?