Here is the code. Thanks in advance for your help.
Sub USG_RAAF_Late()
' Macro USG_14_DAY
' Macro Recorded 5/5/05 by g386179.
Dim Late_Date As Date
Dim Start_Date As Date
Dim Look_Ahead_Date As Date
Dim Entered_Date As Date
Dim sw3 As Integer
Dim SearchString, SearchChar, MyPos
Dim quit_sw As Integer
quit_sw = 0
MyPos = 0
sw3 = 0
WindowSplit
ViewApply Name:="Walts view text1"
SelectTaskColumn Column:="Predecessors"
TableEdit Name:="Walts table text1", TaskTable:=True, NewName:="",
FieldName:="", NewFieldName:="Unique ID", Title:="", Width:=10, Align:=2,
ShowInMenu:=False, LockFirstColumn:=True, DateFormat:=255, RowHeight:=1,
ColumnPosition:=1, AlignTitle:=1
TableApply Name:="Walts table text1"
SelectTaskColumn Column:="Unique ID"
Font Size:="7"
TableEdit Name:="Walts table text1", TaskTable:=True, Align:=1,
ColumnPosition:=1
TableApply Name:="Walts table text1"
ColumnAlignment Align:=pjCenter
SelectTaskColumn Column:="Predecessors", Additional:=1
Font Size:="7"
TableEdit Name:="Walts table text1", TaskTable:=True, Create:=True,
OverwriteExisting:=True, FieldName:="ID", Title:="", Width:=5, Align:=2,
ShowInMenu:=False, LockFirstColumn:=True, DateFormat:=255, RowHeight:=1,
AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Name", Title:="", Width:=73, Align:=0, LockFirstColumn:=True,
DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Unique ID", Title:="", Width:=7, Align:=1,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Predecessors", Title:="Predecessors", Width:=7, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Successors", Title:="Successors", Width:=7, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Flag1", Title:="Weekly Status", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Text1", Title:="", Width:=6, Align:=2, LockFirstColumn:=True,
DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Text6", Title:="", Width:=5, Align:=2, LockFirstColumn:=True,
DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Text2", Title:="Resp", Width:=13, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True, NewFieldName:="%
Complete", Title:="%", Width:=5, Align:=2, LockFirstColumn:=True,
DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Duration", Title:="Dur", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Baseline Start", Title:="BL Start", Width:=8, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Baseline Finish", Title:="BL Finish", Width:=8, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Start", Title:="", Width:=8, Align:=2, LockFirstColumn:=True,
DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Finish", Title:="", Width:=8, Align:=2, LockFirstColumn:=True,
DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Start2", Title:="EAC Start", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Finish2", Title:="EAC Finish", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Actual Finish", Title:="", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Text9", Title:="System", Width:=0, Align:=0,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Text1", Title:="Customer", Width:=0, Align:=0,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Text8", Title:="AC", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Notes", Title:="", Width:=0, Align:=2, LockFirstColumn:=True,
DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Text3", Title:="USG MY / 119", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Text6", Title:="Blk 5.4/FRL", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Text7", Title:="SFI Ph1/Ph2", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Text10", Title:="New ECD", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Text12", Title:="WBS", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Text13", Title:="IMP", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Text14", Title:="IMP No.", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Predecessors", Title:="", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True,
NewFieldName:="Successors", Title:="", Width:=0, Align:=2,
LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, AlignTitle:=1
TableApply Name:="Walts table text1"
SelectTaskColumn Column:="Text6"
ColumnDelete
' code to set color for late, late start and 14 day look ahead
'
SelectTaskColumn Column:="Text2"
TableEdit Name:="Walts table text1", TaskTable:=True, NewName:="",
FieldName:="", NewFieldName:="Text5", Title:="", Width:=10, Align:=2,
ShowInMenu:=False, LockFirstColumn:=True, DateFormat:=255, RowHeight:=1,
ColumnPosition:=6, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True, NewName:="",
FieldName:="", NewFieldName:="Text6", Title:="", Width:=10, Align:=2,
ShowInMenu:=False, LockFirstColumn:=True, DateFormat:=255, RowHeight:=1,
ColumnPosition:=6, AlignTitle:=1
TableEdit Name:="Walts table text1", TaskTable:=True, NewName:="",
FieldName:="", NewFieldName:="Text20", Title:="", Width:=5, Align:=2,
ShowInMenu:=False, LockFirstColumn:=True, DateFormat:=255, RowHeight:=1,
ColumnPosition:=1, AlignTitle:=1
TableApply Name:="Walts table text1"
Entered_Date = InputBox("Enter Late Date")
EditGoTo ID:=1
SelectTaskField Row:=0, Column:="Text5"
Late_Date = Entered_Date
Look_Ahead_Date = Late_Date + 14
'Debug.Print Entered_Date, Look_Ahead_Date, Late_Date
Do
SelectTaskField Row:=0, Column:="Text5"
SearchString = ActiveCell ' put contents of text5 into searchstring
SearchChar = "3" ' looking for a 3 in the text5 position
MyPos = InStr(1, SearchString, SearchChar, 1)
If MyPos > 0 Then
sw3 = 1 ' found a 3 in string
'Debug.Print "3 in the text5 position"
Else
sw3 = 0 ' no 3 found
'Debug.Print "No 3 in the text5 position"
End If
' this code checks for 14 day look ahead and colors accordingly
If sw3 = 1 Then
SelectTaskField Row:=0, Column:="Text6"
If ActiveCell = "5.4" Then ' First check for Blk 5.4 record
SelectTaskField Row:=0, Column:="% Complete"
If ActiveCell < "100%" Then ' Chk to see if task completed
SelectTaskField Row:=0, Column:="Text1"
If ActiveCell = "Block 5.4" Or ActiveCell = "RAAF 5.4"
Then
SelectTaskField Row:=0, Column:="Baseline Start"
If ActiveCell <= Entered_Date + 14 Then
SelectTaskField Row:=0, Column:="Text20"
SetTaskField Field:="Text20", Value:="LA"
SelectRow Row:=0, Extend:=True
Font Bold:=True, Color:=8
End If
End If
End If
End If
End If
' this code checks for late starts
If sw3 = 1 Then
SelectTaskField Row:=0, Column:="Text6"
If ActiveCell = "5.4" Then ' First check for Blk 5.4 record
SelectTaskField Row:=0, Column:="% Complete"
If ActiveCell = "0%" Then ' Chk to see if task completed
SelectTaskField Row:=0, Column:="Text1"
If ActiveCell = "Block 5.4" Or ActiveCell = "RAAF 5.4"
Then
SelectTaskField Row:=0, Column:="Baseline Start"
If ActiveCell <= Entered_Date Then
SelectTaskField Row:=0, Column:="Text20"
SetTaskField Field:="Text20", Value:="LS"
SelectRow Row:=0, Extend:=True
Font Bold:=True, Color:=5
End If
End If
End If
End If
End If
If sw3 = 1 Then
SelectTaskField Row:=0, Column:="Text6"
If ActiveCell = "5.4" Then ' First check for Blk 5.4 record
SelectTaskField Row:=0, Column:="% Complete"
If ActiveCell < "100%" Then ' Chk to see if task completed
SelectTaskField Row:=0, Column:="Text1"
If ActiveCell = "Block 5.4" Or ActiveCell = "RAAF 5.4"
Then
SelectTaskField Row:=0, Column:="Baseline Finish"
If ActiveCell <= Entered_Date Then
SelectTaskField Row:=0, Column:="Text20"
SetTaskField Field:="Text20", Value:="L"
SelectRow Row:=0, Extend:=True
Font Bold:=True, Color:=6
End If
End If
End If
End If
End If
' GoTo Skip_One bypass for test
' the following code turn 100% to green
If sw3 = 1 Then
SelectTaskField Row:=0, Column:="Text6"
If ActiveCell = "5.4" Then ' First check for Blk 5.4 record
SelectTaskField Row:=0, Column:="% Complete"
If ActiveCell = "100%" Then 'Chk to see if task completed
SelectTaskField Row:=0, Column:="Text1"
If ActiveCell = "Block 5.4" Or ActiveCell = "RAAF 5.4"
Then
SelectTaskField Row:=0, Column:="Baseline Start"
SelectTaskField Row:=0, Column:="Text20"
SetTaskField Field:="Text20", Value:="XX"
SelectRow Row:=0, Extend:=True
Font Bold:=True, Color:=9
End If
End If
End If
End If
Skip_One:
SelectRow Row:=1, RowRelative:=True
quit_sw = quit_sw + 1
Loop Until quit_sw >= 8292
'Debug.Print quit_sw, ActiveCell, Entered_Date
'FilterApply Name:="Blk 5.4 60 Day Look Ahead"
FilePageSetupHeader Text:="&""Arial"" &B &20 C-130J Integrated Master
Schedule - USG & RAAF Blk 5.4 "
FilePageSetupPage PercentScale:=65, PaperSize:=pjPaperLetter
FilePageSetupMargins Top:=0.6, Bottom:=0.6
FilePrint FromDate:="4/1/05 8:00 AM", ToDate:="4/1/06 5:00 PM",
Preview:=True
End Sub