Jagwarman
asked on
run macro if cell = 0
I'm sure it's simple but........
If Sheets("Static") D9 = 0
run macro called send mail
Thanks
If Sheets("Static") D9 = 0
run macro called send mail
Thanks
I assume this code has to check that cell automatically without interaction (other than editing the sheet as usual)? Or you want this code to only run when you start another macro?
ASKER
On sheet NDPP there are tick boxes that enter time and user id off back of a macro. So when that runs and populates time and user Id then check D9 in static
For now, this will work for sure (please test it, only a message box will pop up though, that's intended for now)
Code belongs to ThisWorkBook in the VBA editor btw, otherwise it won't work.
After you're satisfied the pop up pops up when it should, we can continue with the mail code (Use outlook? Use smtp?)
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If (Target.Worksheet.Name = "Static") And (ActiveSheet.Cells(9, 4).Value = 0) Then
'mail code
msgbox ("mail code")
End If
End Sub
Code belongs to ThisWorkBook in the VBA editor btw, otherwise it won't work.
After you're satisfied the pop up pops up when it should, we can continue with the mail code (Use outlook? Use smtp?)
ASKER
should this go into a specific module or sheet. I put it in a module, did not work, I put it in Thisworkbook, still did not work, I put it in Sheet3 (Static) still did not work
Should be in Thisworkbook.
Messagebox ONLY shows when you go the sheet Static, and FILL in 0 in D9
Try that first. Really type it in with the keyboard, don't use the tickboxes and what not you have programmed.
Messagebox ONLY shows when you go the sheet Static, and FILL in 0 in D9
Try that first. Really type it in with the keyboard, don't use the tickboxes and what not you have programmed.
ASKER
it works if I key in manually
Okay, that's one step more. Can you tell me what's inside D9? Probably some formula?
Also, how do you intend to send the email, directly smtp or through outlook?
Also, how do you intend to send the email, directly smtp or through outlook?
ASKER
Hi kimputer.
=SUM(D5:D8) is in D9
Regards
=SUM(D5:D8) is in D9
Regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have the code for running the e-mail from Lotus notes so once I get this part to work it will be fine.
I have attached a file which should explain. When you tick box time and name appear. Static sheet is updated.
Checklist.xlsm
I have attached a file which should explain. When you tick box time and name appear. Static sheet is updated.
Checklist.xlsm
I just checked, my updated code works. It means, just copy & paste your working email code, replace the messagebox line.
ASKER
Perfect thanks for all your help