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 www.easyexcela...
www.easyexcela...
Contact me regarding customizing this template for your needs.
www.amazon.com...
How to insert VBA code in Excel • How to insert VBA code...
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 www.easyexcelan... or email me at easyexcelanswers@gmail.com.
Contact me regarding customizing this template for your needs.
Excel one-on-one on-line training available. Email me to arrange.
I am able to provide online help on your computer at a reasonable rate.
Check out my next one-hour Excel Webinar
www.crowdcast....
Check out Crowdcast for creating your webinars
app.linkmink.c...
If you need to buy Office 2019 follow
amzn.to/2VX5dv8
I use Tube Buddy to help promote my videos
Check them out
www.Tubebuddy....
Follow me on twitter
easyexcelanswers
IG @barbhendersonconsulting
You can help and generate a translation to you own language
www.youtube.com...
*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.
Негізгі бет Automatically create shift schedule in Excel
Пікірлер: 133