(i, 5). Value Then  
 maxdl = Sheets ("rez"). Cells (i, 5). Value 
  End If 
  Next i 
  'Визначення кінцевих етапів 
  For i = 2 To n + 1 
  fl = False 
  For j = 2 To n + 1 
  If Not ActiveSheet.Cells (i, j). Value = "" Then 
  fl = True 
  End If 
  Next j 
  If fl = False Then 
  For j = 2 To scount 
  If Sheets ("Rez"). Cells (j, 2). Value = i - 1 Then 
  Sheets ("Rez"). Cells (j, 7). Value = maxdl 
  Sheets ("Rez"). Cells (j, 6). Value = Sheets ("Rez"). Cells (j, 7). Value - Sheets ("Rez"). Cells (j, 3). Value 
  Sheets ("Rez"). Cells (j, 8). Value = Sheets ("Rez"). Cells (j, 7). Value - Sheets ("Rez"). Cells (j, 5). Value 
  End If 
  Next j 
  End If 
  Next i 
  'Заповнення пізнього початку і кінця 
  flag = True 
  Do While flag = True 
  flag = False 
  For i = scount To 2 Step -1 p> If Not Sheets ("Rez"). Cells (i, 6). Value = "" Then 
  remnach = Sheets ("Rez"). Cells (i, 1) 
  remdl = Sheets ("Rez"). Cells (i, 6) 
  For j = scount To 2 Step -1 p> If Sheets ("Rez"). Cells (j, 1).  Value = remnach Then 
  If remdl> Sheets ("Rez"). Cells (j, 6). Value Then 
  remdl = Sheets ("Rez"). Cells (j, 6). Value 
  End If 
  End If 
  Next j 
  For j = scount To 2 Step -1 p> If Sheets ("Rez"). Cells (j, 2). Value = remnach Then 
  Sheets ("Rez"). Cells (j, 7). Value = remdl 
  Sheets ("Rez"). Cells (j, 6). Value = Sheets ("Rez"). Cells (j, 7). Value - Sheets ("Rez"). Cells (j, 3). Value 
				
				
				
				
			  Sheets ("Rez"). Cells (j, 8). Value = Sheets ("Rez"). Cells (j, 7). Value - Sheets ("Rez"). Cells (j, 5). Value 
  End If 
  Next j 
  End If 
  Next i 
  For i = 2 To scount 
  If Sheets ("Rez"). Cells (i, 6). Value = "" Then 
  flag = True 
  End If 
  Next i 
  Loop 
  'Виявлення критичних етапів 
  Sheets ("Rez"). Select 
  For i = 2 To scount 
  If Sheets ("Rez"). Cells (i, 8). Value = 0 Then 
  Range ("A" + Trim (Str (i)) + ": H" + Trim (Str (i))). Select 
  With Selection.Interior 
 . ColorIndex = 35 
 . Pattern = xlSolid 
 . PatternColorIndex = xlAutomatic 
  End With 
  End If 
  Next i 
  Sheets ("Rez"). Cells (scount + 2, 1). Value = "Критичний шлях: "
  'Побудова критичного шляху 
  snum = 1 
  For i = 2 To scount 
  If Sheets ("Rez"). Cells (i, 8). Value = 0 Then 
  Sheets ("Rez"). Cells (scount + 2, 2). Value = Sheets ("Rez"). Cells (i, 1). Value 
  Sheets ("Rez"). Cells (scount + 2, 3). Value = Sheets ("Rez"). Cells (i, 2). Value 
  snum = 3 
  remdl = i 
  i = scount 
  End If 
  Next i 
  For i = remdl To scount 
  If Sheets ("Rez"). Cells (i, 8). Value = 0 Then 
  Sheets ("Rez"). Cells...