|
▼みなさま、
アドバイスを参考に、修正したプログラム(部分)です。
が、Nextに対応するForがありませんとでます。
Forの中にDo Whileを組みこむことはできませんか?
Sub test2()
Dim v As Variant
Dim lc As Long
Dim r As Long
Dim m As Long
Dim i As Long
Const lr As Long = 90
Dim rag As Range, FRw As Long
Dim chk As Boolean
v = Worksheets("人員").Range("A2:A30").Value
With ActiveSheet
If .Name = "営業日" Then
MsgBox "シフト表をアクティブにして実行する事。", 64
Exit Sub
End If
Application.ScreenUpdating = False
' r = 3
i = 1
For r = 3 To 90
chk = r Mod 12 > 2
If chk Then
Do While r <= lr
Select Case True
Case r Mod 4 = 3
lc = 20
m = 6
Case r Mod 4 = 0
lc = 14
m = 8
Case r Mod 4 = 1
lc = 14
m = 8
Case Else
lc = 14
m = 6
End Select
Do While m <= lc
.Cells(r, m).Value = v(i, 1)
i = i + 1
If i > 29 Then i = 1
m = m + 2
Loop
r = r + 1
Loop
Next
Application.ScreenUpdating = True
End With
End Sub
|
|