Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default If statements in macros

I have a macro to send an automated email when passwords need renewing. This
all works fine, but what i want to do is set up another macro to run
automatiocally at 00:00:01 to check if any passwords need changing.

What i have so far is this:-

Sub CheckDay()
Application.OnTime TimeValue("17:00:00"), "my_Procedure"
Range("D7:D30").Select
If Range = 5 Then
Sub SendEmail()
Else
End If
End Sub

So what i want is if a cell in range D7 - D30 is 5 then sub the macro
SendEmail.

For some reason it is not workign and i can't work out why. Any help would
be much appreiciated.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default If statements in macros

Hi,

Try this

Sub CheckDay()
Application.OnTime TimeValue("17:00:00"), "my_Procedure"
For Each c In Range("D7:D30")
If c.Value = 5 Then
Call SendEmail
End If
Next
End Sub

Mike

"Dan Wood" wrote:

I have a macro to send an automated email when passwords need renewing. This
all works fine, but what i want to do is set up another macro to run
automatiocally at 00:00:01 to check if any passwords need changing.

What i have so far is this:-

Sub CheckDay()
Application.OnTime TimeValue("17:00:00"), "my_Procedure"
Range("D7:D30").Select
If Range = 5 Then
Sub SendEmail()
Else
End If
End Sub

So what i want is if a cell in range D7 - D30 is 5 then sub the macro
SendEmail.

For some reason it is not workign and i can't work out why. Any help would
be much appreiciated.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default If statements in macros

Genius!!

Worked first time. Thank you

"Mike H" wrote:

Hi,

Try this

Sub CheckDay()
Application.OnTime TimeValue("17:00:00"), "my_Procedure"
For Each c In Range("D7:D30")
If c.Value = 5 Then
Call SendEmail
End If
Next
End Sub

Mike

"Dan Wood" wrote:

I have a macro to send an automated email when passwords need renewing. This
all works fine, but what i want to do is set up another macro to run
automatiocally at 00:00:01 to check if any passwords need changing.

What i have so far is this:-

Sub CheckDay()
Application.OnTime TimeValue("17:00:00"), "my_Procedure"
Range("D7:D30").Select
If Range = 5 Then
Sub SendEmail()
Else
End If
End Sub

So what i want is if a cell in range D7 - D30 is 5 then sub the macro
SendEmail.

For some reason it is not workign and i can't work out why. Any help would
be much appreiciated.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default If statements in macros

Glad I could help and thanks for the feedback

"Dan Wood" wrote:

Genius!!

Worked first time. Thank you

"Mike H" wrote:

Hi,

Try this

Sub CheckDay()
Application.OnTime TimeValue("17:00:00"), "my_Procedure"
For Each c In Range("D7:D30")
If c.Value = 5 Then
Call SendEmail
End If
Next
End Sub

Mike

"Dan Wood" wrote:

I have a macro to send an automated email when passwords need renewing. This
all works fine, but what i want to do is set up another macro to run
automatiocally at 00:00:01 to check if any passwords need changing.

What i have so far is this:-

Sub CheckDay()
Application.OnTime TimeValue("17:00:00"), "my_Procedure"
Range("D7:D30").Select
If Range = 5 Then
Sub SendEmail()
Else
End If
End Sub

So what i want is if a cell in range D7 - D30 is 5 then sub the macro
SendEmail.

For some reason it is not workign and i can't work out why. Any help would
be much appreiciated.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default If statements in macros

Just two more quick (hopefully) questions:-

1 - I have the macro to ceate the email and input all the required details,
but can't get it to actually send. Is there an extra line i need at the
bottom to actually send?

2 - Can i get these macro's to run even if the sheet isn't open? From what i
have found i don't think i can, but the point of the spreadsheet is to alert
users when there passwords ar edue to expire, so in a perfect world it would
run every day shortly after midnight.

Thanks

"Mike H" wrote:

Glad I could help and thanks for the feedback

"Dan Wood" wrote:

Genius!!

Worked first time. Thank you

"Mike H" wrote:

Hi,

Try this

Sub CheckDay()
Application.OnTime TimeValue("17:00:00"), "my_Procedure"
For Each c In Range("D7:D30")
If c.Value = 5 Then
Call SendEmail
End If
Next
End Sub

Mike

"Dan Wood" wrote:

I have a macro to send an automated email when passwords need renewing. This
all works fine, but what i want to do is set up another macro to run
automatiocally at 00:00:01 to check if any passwords need changing.

What i have so far is this:-

Sub CheckDay()
Application.OnTime TimeValue("17:00:00"), "my_Procedure"
Range("D7:D30").Select
If Range = 5 Then
Sub SendEmail()
Else
End If
End Sub

So what i want is if a cell in range D7 - D30 is 5 then sub the macro
SendEmail.

For some reason it is not workign and i can't work out why. Any help would
be much appreiciated.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default If statements in macros

One more question. If i want the email to specify which system needs the new
password how would i do this?

Currently the email just has some text to say your password needs resetting.

The example of the sheet would be the systems in colum A, in colum B has
whether the password has expired. Therefore i would want the macro to run and
say systems A3, A6 and A9 for example have expired?

If this is very compicated it doesn't matter to much.

Thanks again

"Dan Wood" wrote:

Just two more quick (hopefully) questions:-

1 - I have the macro to ceate the email and input all the required details,
but can't get it to actually send. Is there an extra line i need at the
bottom to actually send?

2 - Can i get these macro's to run even if the sheet isn't open? From what i
have found i don't think i can, but the point of the spreadsheet is to alert
users when there passwords ar edue to expire, so in a perfect world it would
run every day shortly after midnight.

Thanks

"Mike H" wrote:

Glad I could help and thanks for the feedback

"Dan Wood" wrote:

Genius!!

Worked first time. Thank you

"Mike H" wrote:

Hi,

Try this

Sub CheckDay()
Application.OnTime TimeValue("17:00:00"), "my_Procedure"
For Each c In Range("D7:D30")
If c.Value = 5 Then
Call SendEmail
End If
Next
End Sub

Mike

"Dan Wood" wrote:

I have a macro to send an automated email when passwords need renewing. This
all works fine, but what i want to do is set up another macro to run
automatiocally at 00:00:01 to check if any passwords need changing.

What i have so far is this:-

Sub CheckDay()
Application.OnTime TimeValue("17:00:00"), "my_Procedure"
Range("D7:D30").Select
If Range = 5 Then
Sub SendEmail()
Else
End If
End Sub

So what i want is if a cell in range D7 - D30 is 5 then sub the macro
SendEmail.

For some reason it is not workign and i can't work out why. Any help would
be much appreiciated.

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
How can I use wildcards in IF statements and Macros AlanF Excel Discussion (Misc queries) 2 November 22nd 09 11:08 PM
Excel 2007 macros - how to merge 5 macros together into one Sue Excel Discussion (Misc queries) 1 April 16th 08 08:36 PM
IF Statements (Mutliple Statements) Deezel Excel Worksheet Functions 3 October 19th 06 06:13 AM
Training: More on how to use macros in Excel: Recording Macros ToriT Excel Worksheet Functions 2 February 10th 06 07:05 PM
How do i start Macros using IF statements? xXx Katie xXx Excel Discussion (Misc queries) 2 August 22nd 05 03:13 PM


All times are GMT +1. The time now is 06:20 AM.

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

About Us

"It's about Microsoft Excel"