Conditional Message Box
One way:
Put this in your worksheet code module:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const csFILLRANGE As String = "A1:A44"
Dim vResult As Variant
Dim rBlanks As Range
Dim rCell As Range
On Error Resume Next
Set rBlanks = Range(csFILLRANGE).SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If Not rBlanks Is Nothing Then
For Each rCell In rBlanks
With rCell
If .Offset(0, 3).Value 0 Or .Offset(0, 4).Value 0 Then
Do
vResult = Application.InputBox( _
Prompt:="Enter a value for " & _
.Address(False, False) & ":", _
Title:="Fill " & csFILLRANGE, _
Default:=vbNullString, _
Type:=1 + 2)
If vResult = False Then vResult = vbNullString
Loop Until vResult < vbNullString
End If
Application.EnableEvents = False
.Value = vResult
Application.EnableEvents = True
End With
Next rCell
End If
End Sub
In article ,
LaDdIe wrote:
Hiya,
Can anyone tell me how to do the following
If A1 is Blank and D1 or E1 is greater than 0,
Then a message box to pop up requesting a value (text or number) in A1, the
message box to keep appearing until A1 has a value.
This needs to be repeated to A44.
Thanks for any help
Respectx
Laddie
|