|
ほかにもいい方法があるかもしれませんが・・・
こんな感じでしょうか?
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Set R = Intersect(Range("AG8:AG107"), Target.Cells(1))
If R Is Nothing Then Exit Sub
With R
Select Case .Value
Case ""
If Target.Offset(, -31).Value = "" And Target.Offset(, -23).Value = "" Then
MsgBox "B列とJ列にデータがありません"
ElseIf Target.Offset(, -31).Value = "" Or Target.Offset(, -23).Value = "" Then
Select Case True
Case Target.Offset(, -31).Value = ""
MsgBox "B列にデータがありません"
Case Target.Offset(, -23).Value = ""
MsgBox "J列にデータがありません"
End Select
Else
Target.Value = "★"
rc = MsgBox(Target.Offset(, -31) & "の " & Target.Offset(, -23).Value & "は、精算します。 ", vbYes, Title:="精算は・・・")
End If
Case Else
Target.Value = ""
End Select
End With
End Sub
|
|