|
こんにちは
Private Sub Worksheet_Change(ByVal Target As Range)
Dim onDate As Variant
Dim ofDate As Variant
Dim maxvalue As Variant
Application.EnableEvents = False
onDate = Worksheets("Sheet1").Range("B1").Value
ofDate = Worksheets("Sheet1").Range("D1").Value
maxvalue = Worksheets("Sheet1").Range("G1").Value
On Error GoTo End_Len
With Target
If maxvalue = "" Then
MsgBox "最大値を入れてください"
Worksheets("Sheet1").Range("G1").Activate
GoTo End_Len
End If
If onDate = "" Then
MsgBox "日付を入れてください"
Worksheets("Sheet1").Range("B1").Activate
GoTo End_Len
End If
If ofDate = "" Then
MsgBox "日付を入れてください"
Worksheets("Sheet1").Range("C1").Activate
GoTo End_Len
End If
If onDate > ofDate Then
MsgBox "正しい日付を入力してください"
Worksheets("Sheet1").Range("B1").Activate
GoTo End_Len
Else
End If
1_creategraph
End With
On Error GoTo 0
End_Len:
Application.EnableEvents = True
End Sub
で如何かな?
>If onDate Or ofDate Or maxvalue Then
上記は必要ですか?(外してみました)
|
|