Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Conditional Message Box
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Conditional Message Box
Something like this should do it
for i = 1 to 44 if isempty(cells(i, 1) then if cells(i,4) <= 0 then msgbox("please put in a value" end if if cells(i,5) <=0 then msgbox ("please put in a value") end if end if next i "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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Conditional Message Box
Thanks Fellas.
"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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Conditional formatting with a prompt and new email message | Excel Discussion (Misc queries) | |||
Conditional Error Message Once a Range is Activated | Excel Programming | |||
#N/A message & Conditional format | Excel Discussion (Misc queries) | |||
conditional formatting error message | Excel Worksheet Functions | |||
Conditional Message Box | Excel Programming |