|
Sub Main()
Dim Num As Long, X As Long
Const Pmt As String = _
"1から80のいずれかの数値を入力してください"
Do
Num = Application.InputBox(Pmt, Type:=1)
If Num = False Then Exit Sub
Loop While Num < 1 Or Num > 80
X = Num + 7
Call MyCode(X)
End Sub
Sub MyCode(X As Variant)
Dim SetR As Long, Ans As Long
Dim GetV As Variant, GetV2 As Variant
Dim Sh As Worksheet
If IsMissing(X) Then
MsgBox "先にMainプロシージャを実行して下さい", 48
Exit Sub
End If
SetR = CLng(X): Set Sh = Worksheets("契約書作成")
With Worksheets("入力")
GetV1 = .Cells(SetR, 2).Value
GetV2 = .Cells(SetR, 10).Value
Ans = MsgBox(GetV1 & " の契約書を作成しますか" & _
vbLf & "内訳は " & GetV2 & " です", 36)
If Ans = 7 Then GoTo ELine
.Range(.Cells(SetR, 1), .Cells(SetR, 55)).Copy
End With
Sh.Range("AN3").PasteSpecial
With Sh.Range("AM3:DA3").Interior
.ColorIndex = 10
.Pattern = xlSolid
End With
With Application
.CutCopyMode = False
.GoTo Sh.Range("A1"), True
End With
ELine:
Set Sh = Nothing
End Sub
で、よいでしょう。
|
|