
Vary the number of staff for each shift in Excel
Published at : November 22, 2021
Vary the number of staff for each shift in Excel. Create a schedule that allows you to vary the number of people working on different shifts. Check out my online courses www.easyexcelanswers.com/courses.html
All my courses include online support and a user manual
Let me teach you the VBA that I have learn in my five years of consulting
https://barb-s-school-c482.thinkific.com/courses/introduction-to-vba-for-excel
Let's take the frustration out of user forms
https://barb-s-school-c482.thinkific.com/courses/mastering-user-form-in-vba-for-excel
Become an Affiliate and earn 25% on Course Sales
https://barb-s-school-c482.thinkific.com/courses/become-an-affiliate
For more help visit my website www.easyexcelanswers.com or email me at easyexcelanswers@gmail.com.
Contact me regarding customizing this template for your needs.
Click for online Excel Consulting http://www.calendly.com/easyexcelanswers
I am able to provide online help on your computer at a reasonable rate.
https://www.amazon.com/shop/barbhenderson
I use a Blue condenser Microphone to record my videos, here is the link
https://amzn.to/37gyyGa
Check out Crowdcast for creating your webinars
https://app.linkmink.com/a/crowdcast/83
If you need to buy Office 2019 follow
https://amzn.to/2VX5dv8
I use Tube Buddy to help promote my videos
Check them out
https://www.Tubebuddy.com/easyexcelanswers
Follow me on Facebook
https://www.facebook.com/easyexcel.answers
TWEET THIS VIDEO
Follow me on twitter
easyexcelanswers
IG @barbhendersonconsulting
You can help and generate a translation to you own language
http://www.youtube.com/timedtext_cs_panel?c=UCFH2kZykqt-VX5W9waJzYvQ&tab=2
*this description may contain affiliate links. When you click them, I may receive a small commission at no extra cost to you. I only recommend products and services that I've used or have experience with.
Code
Private Sub CommandButton1_Click()
Dim Monday As Long
Dim r, cnt As Long
Dim D As Long
Dim E As Long
Dim N As Long
Dim daynu As Long
Dim evennu, nightnu As Long
r = 5
'Monday
For Each cell In Sheet1.Range("C2:I2")
If cell.Value = 2 Then
Monday = cell.Column
End If
Next cell
D = day.Text
daynu = D + 4
E = even.Text
evennu = daynu + E
N = night.Text
nightnu = evennu + N
For r = 5 To daynu
cnt = 0
Sheet1.Cells(r, Monday).Select
Do While cnt (less than)4
Range(ActiveCell, ActiveCell.Offset(0, 4)).Value = "D"
ActiveCell.Offset(0, 7).Select
cnt = cnt + 1
Loop
Next r
For r = (daynu + 1) To evennu
cnt = 0
Sheet1.Cells(r, Monday).Select
Do While cnt (less than) 4
Range(ActiveCell, ActiveCell.Offset(0, 4)).Value = "E"
ActiveCell.Offset(0, 7).Select
cnt = cnt + 1
Loop
Next r
For r = (evennu + 1) To nightnu
cnt = 0
Sheet1.Cells(r, Monday).Select
Do While cnt (less than)4
Range(ActiveCell, ActiveCell.Offset(0, 4)).Value = "N"
ActiveCell.Offset(0, 7).Select
cnt = cnt + 1
Loop
Next r
End Sub
All my courses include online support and a user manual
Let me teach you the VBA that I have learn in my five years of consulting
https://barb-s-school-c482.thinkific.com/courses/introduction-to-vba-for-excel
Let's take the frustration out of user forms
https://barb-s-school-c482.thinkific.com/courses/mastering-user-form-in-vba-for-excel
Become an Affiliate and earn 25% on Course Sales
https://barb-s-school-c482.thinkific.com/courses/become-an-affiliate
For more help visit my website www.easyexcelanswers.com or email me at easyexcelanswers@gmail.com.
Contact me regarding customizing this template for your needs.
Click for online Excel Consulting http://www.calendly.com/easyexcelanswers
I am able to provide online help on your computer at a reasonable rate.
https://www.amazon.com/shop/barbhenderson
I use a Blue condenser Microphone to record my videos, here is the link
https://amzn.to/37gyyGa
Check out Crowdcast for creating your webinars
https://app.linkmink.com/a/crowdcast/83
If you need to buy Office 2019 follow
https://amzn.to/2VX5dv8
I use Tube Buddy to help promote my videos
Check them out
https://www.Tubebuddy.com/easyexcelanswers
Follow me on Facebook
https://www.facebook.com/easyexcel.answers
TWEET THIS VIDEO
Follow me on twitter
easyexcelanswers
IG @barbhendersonconsulting
You can help and generate a translation to you own language
http://www.youtube.com/timedtext_cs_panel?c=UCFH2kZykqt-VX5W9waJzYvQ&tab=2
*this description may contain affiliate links. When you click them, I may receive a small commission at no extra cost to you. I only recommend products and services that I've used or have experience with.
Code
Private Sub CommandButton1_Click()
Dim Monday As Long
Dim r, cnt As Long
Dim D As Long
Dim E As Long
Dim N As Long
Dim daynu As Long
Dim evennu, nightnu As Long
r = 5
'Monday
For Each cell In Sheet1.Range("C2:I2")
If cell.Value = 2 Then
Monday = cell.Column
End If
Next cell
D = day.Text
daynu = D + 4
E = even.Text
evennu = daynu + E
N = night.Text
nightnu = evennu + N
For r = 5 To daynu
cnt = 0
Sheet1.Cells(r, Monday).Select
Do While cnt (less than)4
Range(ActiveCell, ActiveCell.Offset(0, 4)).Value = "D"
ActiveCell.Offset(0, 7).Select
cnt = cnt + 1
Loop
Next r
For r = (daynu + 1) To evennu
cnt = 0
Sheet1.Cells(r, Monday).Select
Do While cnt (less than) 4
Range(ActiveCell, ActiveCell.Offset(0, 4)).Value = "E"
ActiveCell.Offset(0, 7).Select
cnt = cnt + 1
Loop
Next r
For r = (evennu + 1) To nightnu
cnt = 0
Sheet1.Cells(r, Monday).Select
Do While cnt (less than)4
Range(ActiveCell, ActiveCell.Offset(0, 4)).Value = "N"
ActiveCell.Offset(0, 7).Select
cnt = cnt + 1
Loop
Next r
End Sub

Vary the number of staff for each shift in Excelexcelmicrosoft excel