View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default VBA Newbie stuck

put this code in the appropriate sheet module ie (sheet1, sheet2 etc...)



sub worksheet_change(byval target as excel.range)
'Macro to give a message if the flexi time = 15:00

If Range ("Flexi_hours_gained")=0.625 then
MsgBox "15 hours is the maximum allowable flexi time gained"
End If
End Sub


--
When you lose your mind, you free your life.


"Danny Jurmann" wrote:

Hi folks,

I wonder if anyone can help. I have created a macro to create a message box
if the value of a cell is greater than 15 hours.

I have:-

sub flexi_hours_gained()
'Macro to give a message if the flexi time = 15:00

If Range ("Flexi_hours_gained")=0.625 then
MsgBox "15 hours is the maximum allowable flexi time gained"
End If
End Sub

So far so good, I run the macro and it works, but I need the message box to
appear automatically if the range value is 15 hours (0.625). The range
value is not entered but calculated and the cell is protected, part of a
protected sheet.

Anyone have any ideas? For the recortd I have been learning VBA for about 4
hours :-)

Thanks in advance,

Danny