Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional formatting with a prompt and new email message Tammy Excel Discussion (Misc queries) 1 December 21st 09 08:38 PM
Conditional Error Message Once a Range is Activated Jim Excel Programming 1 February 8th 07 05:21 PM
#N/A message & Conditional format Ken Excel Discussion (Misc queries) 6 January 25th 07 06:34 PM
conditional formatting error message Karla V Excel Worksheet Functions 3 October 31st 06 03:37 AM
Conditional Message Box Adam Harding Excel Programming 2 August 4th 05 10:13 AM


All times are GMT +1. The time now is 02:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"