|
▼nonoka さん:
Input消去 は変更ありません。
Sub Sample2()
Dim n1 As Long
Dim n2 As Long
Dim nx As Long
Dim n As Long
Dim shTo As Worksheet
Dim z1 As Long
Dim z2 As Long
Dim x As Long
Dim c As Range
Set shTo = Sheets("計画表")
With Sheets("INPUT")
Call Input消去
z1 = 7 'INPUTのコピー開始行
n1 = Val(.Range("F5").Value)
n2 = Val(.Range("H5").Value)
If n1 = 0 Or n2 = 0 Then
MsgBox "F5とH5に正しい数字をいれてくださいね"
Exit Sub
End If
n = n1 \ n2
nx = n1 Mod n2
If nx > 0 Then n = n + 1
If n < 1 Then
MsgBox "F5またはH5の数字が正しくないのでは?"
Exit Sub
End If
x = 6 'コピー列数
If n > 0 Then
z2 = shTo.Range("C" & shTo.Rows.Count).End(xlUp).Row + 1
.Range("C5").Resize(, x).Copy .Range("C" & z1).Resize(n)
.Range("C5").Resize(, x).Copy shTo.Range("C" & z2).Resize(n)
If nx > 0 Then
.Range("H" & z1).Offset(n - 1).Value = nx
shTo.Range("H" & z2).Offset(n - 1) = nx
End If
End If
End With
End Sub
|
|