Code first:
If 6 > Me.cmbShiftNumber.Value >= 1 Then
.Cells(3, 1).Value = Me.cmbS1T1.Value
.Cells(3, 3).Value = Me.cmbS1T2.Value
If Me.cmbPpl1.Value > 0 Then
.Cells(4, 1).Value = "1)"
End If
If Me.cmbPpl1.Value > 1 Then
.Cells(4, 3).Value = "2)"
End If
If Me.cmbPpl1.Value > 2 Then
.Cells(5, 1).Value = "3)"
End If
If Me.cmbPpl1.Value > 3 Then
.Cells(5, 3).Value = "4)"
End If
If Me.cmbPpl1.Value > 4 Then
.Cells(6, 1).Value = "5)"
End If
'etc
Else
.Cells(3, 1).Value = Me.cmbS1T1.Value
.Cells(3, 2).Value = Me.cmbS1T2.Value
If Me.cmbPpl1.Value > 0 Then
.Cells(4, 1).Value = "1)"
End If
If Me.cmbPpl1.Value > 2 Then
.Cells(4, 2).Value = "2)"
End If
'etc
End If
As you can see this is a repetitive if formula.
It is based off of combo boxes names cmbS1T1-cmbS10T2
Then for each there is cmbPpl1-14
The usage is the start time and end time of each shift. (S = shift) (T = 1 for start, 2 for end)
The cmbPpl are how many people will be at each shift 1-14
If you look at the above code you will see the cells it is going into. Same repetitions as above.
The only difference is that if there are less than 6, it should use the entire box and if more than 6 it will split the 4 cells wide box in half and use the first half for shift 1 and the second shift would be in the smaller box to the right it just split to.
Examples are included in the attached excel document.
Any questions please ask.
I am just looking for a condensed loop formula of some sort that would do this before I spend 4 hours writing it all out. I am sure there is a better way.
Thanks.
Bookmarks