Reputation: 19
I must create a scheduling code that will generate the steps to its respective day. This process is 6 steps and each step takes a day, however it cannot be done on weekends which I have colored coated grey. Is there a way to code in VBA to say that if the process starts Wednesday, it will generate Steps 6-4 for Wed-Fri and then resume the rest of the process on Monday for steps 3-1? Below is the code I have created to generate the steps into its respective box. I appreciate the help!
Sub Process()
Dim c As Range
If Selection.Value = "Step 6" Then
Selection.Offset(0, 1).Value = "Step 5"
Selection.Offset(0, 2).Value = "Step 4"
Selection.Offset(0, 3).Value = "Step 3"
Selection.Offset(0, 4).Value = "Step 2"
Selection.Offset(0, 5).Value = "Step 1"
Selection.Offset(0, 6).Value = "Finish"
End If
End Sub
Upvotes: 0
Views: 113
Reputation: 19
Thanks for the input! I was able to create and test a code myself based on the weekends gray color
ActiveCell.Value = "Step 1"
If Selection.Offset(0, 1).Interior.ColorIndex = 15 Then
Selection.Offset(0, 4).Value = "Step 2"
Selection.Offset(0, 5).Value = "Step 3"
ElseIf Selection.Offset(0, 2).Interior.ColorIndex = 15 Then
Selection.Offset(0, 1).Value = "Step 2"
Selection.Offset(0, 5).Value = "Step 3"
ElseIf Selection.Offset(0, 3).Interior.ColorIndex = 15 Then
Selection.Offset(0, 1).Value = "Step 2"
Selection.Offset(0, 2).Value = "Step 3"
End If
End Sub
Upvotes: 1