Advertisement
Guest User

Untitled

a guest
Apr 13th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub NewGroupTask()
  2. '
  3. ' NewGroupTask Macro
  4. '
  5.  
  6. '
  7.    ' Unprotect sheet to allow editing
  8.    ActiveSheet.Unprotect Password:="adminpw"
  9.    
  10.    
  11.         ' Get information about new task and cancel if user cancelled inputbox
  12.        Dim TaskNum As Variant
  13.         TaskNum = InputBox("Enter the Task Number from the Gantt Chart", "Add New Group Task", 1)
  14.         If TaskNum = vbNullString Then
  15.             MsgBox ("You cancelled - the new group task won't be added.")
  16.             Exit Sub
  17.         End If
  18.        
  19.         Dim TaskDescription As Variant
  20.         TaskDescription = InputBox("Enter the Task Description", "Add New Group Task", 1)
  21.         If TaskDescription = vbNullString Then
  22.             MsgBox ("You cancelled - the new group task won't be added.")
  23.             Exit Sub
  24.         End If
  25.        
  26.         Dim TaskWorkDays As Variant
  27.         TaskWorkDays = InputBox("Enter the number of Work Days for this task", "Add New Group Task", 1)
  28.         If TaskWorkDays = vbNullString Then
  29.             MsgBox ("You cancelled - the new group task won't be added.")
  30.             Exit Sub
  31.         End If
  32.        
  33.         Dim TaskLink As Variant
  34.         TaskLink = InputBox("Enter a working URL where the task can be found." & vbCrLf & vbCrLf & "Enter 'N/a' if there is no link." & vbCrLf & "or Enter '???' if you don't know where the link is.", "Add New Group Task", 1)
  35.         If TaskLink = vbNullString Then
  36.             MsgBox ("You cancelled - the new group task won't be added.")
  37.             Exit Sub
  38.         End If
  39.  
  40.         ' Create new task
  41.        Range("B200").Select
  42.         Selection.End(xlUp).Select
  43.        
  44.         Range(ActiveCell.Offset(-4, 0), ActiveCell.Offset(2, 17)).Select
  45.         Selection.Copy
  46.        
  47.         ActiveCell.Offset(3, 0).Select
  48.         ActiveCell.Offset(4, 0).Select
  49.        
  50.         ActiveSheet.Paste
  51.        
  52.         ActiveCell.Worksheet.Cells(ActiveCell.Row - 1, 1).EntireRow.Select
  53.         Selection.RowHeight = 30
  54.        
  55.        
  56.         ' Set task information based on what user entered
  57.        ActiveCell.Offset(5, 1).Value = TaskNum
  58.         ActiveCell.Offset(5, 2).Value = TaskDescription
  59.         ActiveCell.Offset(5, 3).Value = TaskWorkDays
  60.         ActiveCell.Offset(5, 4).Value = "?"
  61.         ActiveCell.Offset(5, 5).Value = "?"
  62.         ActiveCell.Offset(5, 6).Value = "?"
  63.         ActiveCell.Offset(5, 7).Value = "?"
  64.         ActiveCell.Offset(5, 10).Value = "...Enter your comments here..."
  65.         ActiveCell.Offset(8, 12).Value = TaskLink
  66.        
  67.         ActiveCell.Offset(5, 0).Select
  68.        
  69.         ActiveCell.Worksheet.Cells(ActiveCell.Row, 1).EntireRow.Select
  70.         Selection.RowHeight = 23.8
  71.        
  72.         ActiveCell.Offset(0, 10).Select
  73.        
  74.        
  75.         ' - Update total (Cell G4) to include new task -
  76.        Call UpdateGroupTotal
  77.    
  78.     ' Protect document
  79.    ActiveSheet.Protect Password:="adminpw", DrawingObjects:=True, Contents:=True, Scenarios:=True
  80.    
  81. End Sub
  82. Sub NewIndividualTask()
  83. '
  84. ' NewGroupTask Macro
  85. '
  86.  
  87. '
  88.    ' Unprotect sheet to allow editing
  89.    ActiveSheet.Unprotect Password:="adminpw"
  90.    
  91.    
  92.         ' Get information about new task and cancel if user cancelled inputbox
  93.        Dim TaskNum As Variant
  94.         TaskNum = InputBox("Enter the Task Number from the Gantt Chart", "Add New Group Task", 1)
  95.         If TaskNum = vbNullString Then
  96.             MsgBox ("You cancelled - the new group task won't be added.")
  97.             Exit Sub
  98.         End If
  99.        
  100.         Dim TaskDescription As Variant
  101.         TaskDescription = InputBox("Enter the Task Description", "Add New Group Task", 1)
  102.         If TaskDescription = vbNullString Then
  103.             MsgBox ("You cancelled - the new group task won't be added.")
  104.             Exit Sub
  105.         End If
  106.        
  107.         Dim TaskWorkDays As Variant
  108.         TaskWorkDays = InputBox("Enter the number of Work Days for this task", "Add New Group Task", 1)
  109.         If TaskWorkDays = vbNullString Then
  110.             MsgBox ("You cancelled - the new group task won't be added.")
  111.             Exit Sub
  112.         End If
  113.        
  114.         Dim TaskLink As Variant
  115.         TaskLink = InputBox("Enter a working URL where the task can be found." & vbCrLf & vbCrLf & "Enter 'N/a' if there is no link." & vbCrLf & "or Enter '???' if you don't know where the link is.", "Add New Group Task", 1)
  116.         If TaskLink = vbNullString Then
  117.             MsgBox ("You cancelled - the new group task won't be added.")
  118.             Exit Sub
  119.         End If
  120.  
  121.         ' Create new task
  122.        Range("B200").Select
  123.         Selection.End(xlUp).Select
  124.        
  125.         Range(ActiveCell.Offset(-4, 0), ActiveCell.Offset(2, 17)).Select
  126.         Selection.Copy
  127.        
  128.         ActiveCell.Offset(3, 0).Select
  129.         ActiveCell.Offset(4, 0).Select
  130.        
  131.         ActiveSheet.Paste
  132.        
  133.         ActiveCell.Worksheet.Cells(ActiveCell.Row - 1, 1).EntireRow.Select
  134.         Selection.RowHeight = 30
  135.        
  136.        
  137.         ' Set task information based on what user entered
  138.        ActiveCell.Offset(5, 1).Value = TaskNum
  139.         ActiveCell.Offset(5, 2).Value = TaskDescription
  140.         ActiveCell.Offset(5, 3).Value = TaskWorkDays
  141.         ActiveCell.Offset(5, 4).Value = "?"
  142.         ActiveCell.Offset(5, 5).Value = "?"
  143.         ActiveCell.Offset(5, 6).Value = "?"
  144.         ActiveCell.Offset(5, 9).Value = ""
  145.         ActiveCell.Offset(6, 9).Value = ""
  146.         ActiveCell.Offset(7, 9).Value = ""
  147.         ActiveCell.Offset(8, 11).Value = TaskLink
  148.        
  149.         ActiveCell.Offset(5, 0).Select
  150.        
  151.         ActiveCell.Worksheet.Cells(ActiveCell.Row, 1).EntireRow.Select
  152.         Selection.RowHeight = 23.8
  153.        
  154.         ActiveCell.Offset(0, 9).Select
  155.        
  156.        
  157.         ' - Update total (Cell G4) to include new task -
  158.        Call UpdateIndividualTotal
  159.    
  160.     ' Protect document
  161.    ActiveSheet.Protect Password:="adminpw", DrawingObjects:=True, Contents:=True, Scenarios:=True
  162.    
  163. End Sub
  164. Public Sub UpdateGroupTotal()
  165. '
  166. ' - Update total (Cell G4) to include new task -
  167. '
  168.    
  169.         Dim RunningTotal As String
  170.         RunningTotal = "D15"
  171.        
  172.         Dim counter As Integer
  173.         counter = 25
  174.        
  175.         Dim TaskCount As Integer
  176.         TaskCount = Range("T208").Value
  177.        
  178.         For i = 2 To TaskCount
  179.             RunningTotal = RunningTotal & "+D" & counter
  180.             counter = counter + 10
  181.         Next i
  182.    
  183.         Range("G4").Value = "=IFERROR(" & RunningTotal & ",""(Need Ratings)"")"
  184.    
  185. End Sub
  186. Public Sub UpdateIndividualTotal()
  187. '
  188. ' - Update total (Cell G4) to include new task -
  189. '
  190.    
  191.         Dim RunningTotal As String
  192.         RunningTotal = "D15"
  193.        
  194.         Dim counter As Integer
  195.         counter = 25
  196.        
  197.         Dim TaskCount As Integer
  198.         TaskCount = Range("S208").Value
  199.        
  200.         For i = 2 To TaskCount
  201.             RunningTotal = RunningTotal & "+D" & counter
  202.             counter = counter + 10
  203.         Next i
  204.    
  205.         Range("G4").Value = "=IFERROR(" & RunningTotal & ",""(Need Ratings)"")"
  206.    
  207. End Sub
  208. Sub RemoveGroupTask()
  209. '
  210. ' - Ask Rich to Delete Group Tasks
  211. '
  212.    
  213.     Result = MsgBox("Please talk to Rich if you want a Task removed." & vbCrLf & vbCrLf & "(I'll do it manually)", vbInformation, "Remove a Task")
  214.        
  215. End Sub
  216. Sub SelectMenu()
  217. '
  218. ' Macro to go to the Main Menu
  219. '
  220.  
  221.     Sheets("Main Info").Select
  222.    
  223. End Sub
  224. Sub SelectDocumentation()
  225. '
  226. ' Macro to go to the Documentation sheet
  227. '
  228.  
  229.     Sheets("Documentation").Select
  230.    
  231. End Sub
  232. Sub SelectGroupTasks()
  233. '
  234. ' Macro to view the Group Tasks
  235. '
  236.  
  237.     Sheets("All Group Members").Select
  238.    
  239. End Sub
  240. Sub SelectAndrew()
  241. '
  242. ' Macro to view Andrew's Tasks
  243. '
  244.  
  245.     Sheets("Andrew").Select
  246.    
  247. End Sub
  248. Sub SelectOla()
  249. '
  250. ' Macro to view Ola's Tasks
  251. '
  252.  
  253.     Sheets("Ola").Select
  254.    
  255. End Sub
  256. Sub SelectRich()
  257. '
  258. ' Macro to view Rich's Tasks
  259. '
  260.  
  261.     Sheets("Rich").Select
  262.    
  263. End Sub
  264. Sub SelectZeeshan()
  265. '
  266. ' Macro to view Zeeshan's Tasks
  267. '
  268.  
  269.     Sheets("Zeeshan").Select
  270.    
  271. End Sub
  272. Sub SelectGroup()
  273. '
  274. ' Macro to view Zeeshan's Tasks
  275. '
  276.  
  277.     Sheets("All Group Members").Select
  278.    
  279. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement