Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default macro not running on workbook open

Yes it does become true. Received another point re using Private Sub
Workbook_Open() event..... so solved now. Thanks for the tip re With.

"NickHK" wrote:

Nick,
Depending on what you have in these cells, I see you are formatting one, but
not the other:
TodaysDay = Format(ThisWorkbook.Sheets("Instructions").Range(" C1"), "ddd")
ReportDueDay = ThisWorkbook.Sheets("Instructions").Range("F" & i)
So does this ever become true :
If ReportDueDay = TodaysDay Then

NickHK

P.S.
You will you code more readable by using "With". e.g.
With ThisWorkbook.Sheets("Instructions")
....etc


"Nick Smith" wrote in message
...
For some reason this macro doesn't run on workbook open (or if it does

it's
not doing what it's suppoed to do).
It works fine if manually run through the tools menu, but even though it

is
written in the ThisWorkbook module, no joy. [note, Cell C1 contains the
formula =today()]. The only think I can think is that the =today()

formula
in Cell C1 hasn't calculated prior to the macro running (as it runs on
workbook open) so there is no data to conduct the comparison. If so, how

can
I incorporate the =today() function in the macro itself and then conduct

the
textual day comparison, i.e. if today is "Thu" and Cell F28 contains "Thu"
then returns MsgBox with text from cell C28.

Sub ReminderMessageOnOpening()

Dim ReportType As String
Dim TodaysDay As String
Dim ReportDueDay As String
Dim i As Integer

For i = 28 To 33
If ThisWorkbook.Sheets("Instructions").Range("C" & i) < "" And
ThisWorkbook.Sheets("Instructions").Range("F" & i) < "" Then
TodaysDay = Format(ThisWorkbook.Sheets("Instructions").Range(" C1"),
"ddd")
ReportDueDay = ThisWorkbook.Sheets("Instructions").Range("F" & i)
ReportType = ThisWorkbook.Sheets("Instructions").Range("C" & i)
If ReportDueDay = TodaysDay Then
MsgBox ("REMINDER ..... REMINDER ..... REMINDER " & vbNewLine &
ReportType & " due " & ReportDueDay)
End If
End If
Next i
End Sub

Any help appreciated!

Thanks,

Nick




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
Excel 2003 - Keep a Macro Running While the Workbook is Open MaxRoberts22 Excel Programming 4 January 10th 06 07:33 PM
Running a macro in a open as read-o Workbook TBarreiro Excel Programming 0 September 2nd 05 04:06 PM
Running a macro in a open as read-o Workbook TBarreiro Excel Programming 0 September 2nd 05 04:02 PM
Running a macro in a open as read-o Workbook TBarreiro Excel Programming 0 September 2nd 05 03:55 PM
Application Error when running Macro on Workbook open TM[_2_] Excel Programming 1 October 2nd 03 10:53 AM


All times are GMT +1. The time now is 03:55 PM.

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"