Create a schedule with every fourth weekend off in Excel



Create a schedule with every fourth weekend off in Excel. When staff work 7 days a week, allow them to have every fourth weekend off.
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

Let’s take the frustration out of user forms

Become an Affiliate and earn 25% on Course Sales

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

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

I use a Blue condenser Microphone to record my videos, here is the link

Check out Crowdcast for creating your webinars

If you need to buy Office 2019 follow

I use Tube Buddy to help promote my videos
Check them out

Follow me on Facebook

TWEET THIS VIDEO

Follow me on twitter
easyexcelanswers

IG @barbhendersonconsulting

You can help and generate a translation to you own language

*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
Sub autoshift()
Dim sat As Long
Dim startpos As Range
Dim secwk As Integer
Dim rng As Range
Dim fstwk As Long
Dim findstring As String
Dim thrdwk As Long
Dim fourwk As Long
Dim cnt As Long
Dim r, c As Long

sat = 7
findstring = sat
With Sheets(“Sheet1”).Range(“b3:I3”)
Set rng = .Find(What:=findstring, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False)

End With

fstwk = (rng.Column)
secwk = (fstwk + 7)
thrdwk = fstwk + 14
fourwk = fstwk + 21

For r = 7 To 26

If (r = 7 Or r = 11 Or r = 15 Or r = 19 Or r = 23) Then

Sheets(“Sheet1”).Cells(r, fstwk) = “O”
Sheets(“Sheet1”).Cells(r, fstwk).Offset(0, 1) = “O”
Set startpos = Sheets(“Sheet1”).Cells(r, fstwk)
startpos.Offset(0, 5).Value = “O”
startpos.Offset(0, 10).Value = “O”
startpos.Offset(0, 13).Value = “O”
startpos.Offset(0, 16).Value = “O”
startpos.Offset(0, 20).Value = “O”
startpos.Offset(0, 25).Value = “O”

End If
If (r = 8 Or r = 12 Or r = 16 Or r = 20 Or r = 24) Then
Sheets(“Sheet1”).Cells(r, secwk) = “O”
Sheets(“Sheet1”).Cells(r, secwk).Offset(0, 1) = “O”

Set startpos = Sheets(“Sheet1”).Cells(r, secwk)
startpos.Offset(0, -3).Value = “O”
startpos.Offset(0, 5).Value = “O”
startpos.Offset(0, 10).Value = “O”
startpos.Offset(0, 13).Value = “O”
startpos.Offset(0, 16).Value = “O”
startpos.Offset(0, 19).Value = “O”
startpos.Offset(0, 25).Value = “O”
End If

If (r = 9 Or r = 13 Or r = 17 Or r = 21 Or r = 25) Then
Sheets(“Sheet1”).Cells(r, thrdwk) = “O”
Sheets(“Sheet1”).Cells(r, thrdwk).Offset(0, 1) = “O”
Set startpos = Sheets(“Sheet1”).Cells(r, thrdwk)
startpos.Offset(0, -3).Value = “O”
startpos.Offset(0, -8).Value = “O”
startpos.Offset(0, -12).Value = “O”
startpos.Offset(0, 5).Value = “O”
startpos.Offset(0, 10).Value = “O”
startpos.Offset(0, 12).Value = “O”

End If

If (r = 10 Or r = 14 Or r = 18 Or r = 22 Or r = 26) Then

Sheets(“Sheet1”).Cells(r, fourwk) = “O”
Sheets(“Sheet1”).Cells(r, fourwk).Offset(0, 1) = “O”
Set startpos = Sheets(“Sheet1”).Cells(r, fourwk)
startpos.Offset(0, -3).Value = “O”
startpos.Offset(0, -8).Value = “O”
startpos.Offset(0, -12).Value = “O”
startpos.Offset(0, -15).Value = “O”
startpos.Offset(0, -18).Value = “O”
startpos.Offset(0, 6).Value = “O”

End If
Next r

End Sub

Watch more new videos about Excel Office | Synthesized by Mindovermetal English

Rate this post

Bài viết liên quan

Theo dõi
Thông báo của
guest
0 Comments
Phản hồi nội tuyến
Xem tất cả bình luận