数値をリモートで列に記入する際にExcelが終了しないようにするマクロが必要です。最初は、ユーザーにIDの入力を依頼します。次のステップは閉鎖を防ぐことです。どのようにそれを行うことができますか?リモートでデータを入力している間にExcelが終了しないように制限する方法
以下は、ID入力とセル選択のコードです。次のように
Sub Enter_1()
Dim data_1 As String
Dim sCell As Variant
Dim rslt As Integer
Dim x As Integer
Do
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
data_1 = InputBox(Prompt:="Enter Employee No.", Title:="Employee", Default:="Enter Employee No. here")
If data_1 = "" Then
QuestionToMessageBox = "Exit?"
YesOrNoAnswerToMessageBox = MsgBox(QuestionToMessageBox, vbYesNo, "No")
End If
If YesOrNoAnswerToMessageBox = vbNo Then
data_1 = InputBox(Prompt:="Enter Employee No.", Title:="Employee", Default:="Enter Employee No. here")
Exit sub
End If
If Not IsNumeric(data_1) Or data_1 = "" Then
rslt = 0
Else: rslt = 1
End If
If rslt = 0 Then
MsgBox "You can only enter a number in this field"
Else:
Sheets("Oven After Assay Test").Activate
For x = 6 To 50
If Cells(x, 8).Value = "" Then
Cells(x, 8).Select
cancel = True
Exit For
End If
Next
End If
Loop While rslt = 0
End Sub
Before_closeブックのイベントを使用する必要があります。閉じるときに停止するには、Cancelプロパティをtrueに設定します。しかし、ユーザーがExcelを強制終了したい場合、実際にExcelを停止することはできません。 [google](http://google.com) – vacip