Msgbox

P

pushp

I am trying to have a msgbox in case B10 is greater than 0 (Zero)...

Sub workbook_open()

If Cells(10, 2) > 0 Then
msg = MsgBox("Need investigation.... ", vbOKOnly, "Money Missing")
End If

End Sub

However, this code runs very well when i play from VBE but does no
work when I open this work book. I want when ever I open workbook an
B10 is greater than 0 then it should give me this message...
I neeeeeed badly you help please..
 
F

Frank Kabel

Hi
you have to place this code in your workbook module ('ThisWorkbook').
Also you should add the sheet name to your refeerence. e.g.
IF worksheets("sheet1").cells(10,2)>0 then
 
F

Frank Stone

Hi,
I would add that to display on open, it has to be in the
on open event i.e. ThisWorkbook_onOpen()
 
D

DonnyK9

Type the code in the Workbook_Open event.
This sub is an option in the VBA editor and not something
you'd need to create yourself.
As has already been said,you need to specify which sheet
you're referring to and lose the msg


Private Sub Workbook_Open()
if Sheet(sheet name/number).cells(10,2)> 0 then
msgbox "Need investigation....", "Money Missing"
end if
End Sub
 
Top