|
かな?
Sub 事務所公休設定2()
'***************************************************************
'* 事務所 公休自動貼り付け処理 *
'***************************************************************
Dim RRET As Long
Dim RYOUBI As String
' Dim RDAY As Date
Dim RDAY As Variant
' Dim SDAY As String
Dim SDAY As Variant
Dim WGYO As Long
Dim DGYOMAX As Long
RRET = 5 '1日目設定
DGYOMAX = Worksheets("事務所勤務").Range("D65536").End(xlUp).Row
Do Until RRET > 36
WGYO = 8
' MsgBox "Cells(5, RRET)" & Cells(5, RRET)
RDAY = Cells(5, RRET)
RYOUBI = Cells(6, RRET).Value
' SDAY = Application.Match(Cells(5, RRET).Value, Range("C72:C98"), 0)
SDAY = Application.Match(CLng(RDAY), Range("C72:C98"), 0)
If Application.IsError(SDAY) = False Then
Do Until WGYO > DGYOMAX
Cells(WGYO, RRET).Value = "公"
WGYO = WGYO + 1
Loop
Else
WGYO = 8
End If
If RYOUBI = "土" Then
WGYO = 8
Do Until WGYO > DGYOMAX
Cells(WGYO, RRET).Value = "公"
WGYO = WGYO + 1
Loop
Else
If RYOUBI = "日" Then
WGYO = 8
Do Until WGYO > DGYOMAX
Cells(WGYO, RRET).Value = "公"
WGYO = WGYO + 1
Loop
Else
WGYO = 8
End If
End If
RRET = RRET + 1
Loop
End Sub
|
|