Get YouTube subscribers that watch and like your videos
Get Free YouTube Subscribers, Views and Likes

Automatically create shift schedule in Excel

Follow
Barb Henderson

Automatically create shift schedule in Excel. Enter work days and off days for each of your staff. VBA code included. Use the offset function. Use the search and replace function. Check out my templates page for free and purchased templates https://www.easyexcelanswers.com/temp...
https://www.easyexcelanswers.com/cour...

Contact me regarding customizing this template for your needs.
https://www.amazon.com/shop/barbhende...
How to insert VBA code in Excel    • How to insert VBA code in Excel  
sub autoschedule ()
Dim i as integer

for i = 4 to 11
if i = 4 then
Worksheets("Sheet1").Range(Cells(i, 3), Cells(i, 4)).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 7).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 14).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 21).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 28).Value = "O"
End if
if i = 5 then
Worksheets("Sheet1").Range(Cells(i, 3), Cells(i, 4)).Offset(0, 1).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 8).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 15).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 22).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 29).Value = "O"
End if
if i = 6 then
Worksheets("Sheet1").Range(Cells(i, 3), Cells(i, 4)).Offset(0, 2).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 9).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 16).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 23).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 30).Value = "O"
End if
if i = 7 then
Worksheets("Sheet1").Range(Cells(i, 3), Cells(i, 4)).Offset(0, 3).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 10).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 17).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 24).Value = "O"
End if
if i = 8 then
Worksheets("Sheet1").Range(Cells(i, 3), Cells(i, 4)).Offset(0, 4).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 11).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 18).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 25).Value = "O"
End if
if i = 9 then
Worksheets("Sheet1").Range(Cells(i, 3), Cells(i, 4)).Offset(0, 5).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 12).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 19).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 26).Value = "O"
End if
if i = 10 then
Worksheets("Sheet1").Range(Cells(i, 3), Cells(i, 4)).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 7).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 14).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 21).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 28).Value = "O"
End if
if i = 11 then
Worksheets("Sheet1").Range(Cells(i, 3), Cells(i, 4)).Offset(0, 1).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 8).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 15).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 22).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 29).Value = "O"
End if
if i = 12 then
Worksheets("Sheet1").Range(Cells(i, 3), Cells(i, 4)).Offset(0, 2).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 9).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 16).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 23).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 30).Value = "O"
End if
if i = 13 then
Worksheets("Sheet1").Range(Cells(i, 3), Cells(i, 4)).Offset(0, 3).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 10).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 17).Value = "O"
Range(Cells(i, 3), Cells(i, 4)).Offset(0, 24).Value = "O"
End if
Range("c4:AG13").Replace What:="", Replacement:="X"
End Sub

For more help visit my website http://www.easyexcelanswers.com or email me at [email protected].

Contact me regarding customizing this template for your needs.

Excel oneonone online training available. Email me to arrange.

I am able to provide online help on your computer at a reasonable rate.

Check out my next onehour Excel Webinar
https://www.crowdcast.io/easyexcelans...


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/easyexcelan...



Follow me on twitter
easyexcelanswers

IG @barbhendersonconsulting

You can help and generate a translation to you own language
http://www.youtube.com/timedtext_cs_p...

*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.

posted by citologakb