Posted to microsoft.public.excel.programming
|
|
Using IS statements
Cheers Nick,
Got something similar to that in the end. Really appreciate the input
from everyone, can't believe how much I have learned in jsut 3 days!
Doo x
NickHK wrote:
OK, but before you did not mention the TODAY aspect of "first time you open
the workbook today".
This works for me :
Private Sub Workbook_Open()
With Worksheets("sheet2").Range("A1")
If Format(Now(), "DD") = 31 And .Value < Format(Now(), "DD.MM.YYYY")
Then
MsgBox ("It's the first of the month and first time you open the
workbook today"), vbOKOnly
.Value = Format(Now(), "DD.MM.YYYY")
End If
End With
End Sub
NickHK
"Doo0592" wrote in message
oups.com...
First time the workbook opens on the first of the month.
So far I have this (provided by carlos)
Private Sub Workbook_Open()
If Format(Now(), "DD") = 1 And _
Worksheets("sheet2").Range("A1") < Format(Now(), "DD.MM.YYYY")
Then _
MsgBox ("It's the first of the month and first time you open
the workbook today"), vbOKOnly
worksheets("sheet2").range("A1").formular1c1 = format(now),
"DD.MM.YYYY"
End If
End Sub
but the last line doesn't work.. syntax is wrong. Can anyone spot why?
Bob...still having a look at yours honey :)
NickHK wrote:
So which is it ?
1 - Only the first time the WB is opened ?
2 - The first time AND every 1st of the month ?
NickHK
"Doo0592" wrote in message
ups.com...
Yup, that's the plan Nick :) Does anyone know how I can test this
without waiting for the first of the month or changing the system time
( it's been disabled cause I is at work)?
Ta
Doo
NickHK wrote:
Surely the first of the month criteria is irrelevant if you want the
msgbox
the first time the WB opens ?
Unless you mean the first time AND the first of the month ??
NickHK
"Doo0592" wrote in message
ups.com...
Hi all,
Can anyone help me combine these two statements into an IS
statement?
Don't quite understand the VB help! Funnily enough! :) lol
Private sub Workbook_Open()
If Month (Date) < Sheet1.Range("A1").Value Then
MsgBox("This message should appear on the first of every
month
and only the first time the workbook opens")
Sheet1.Range("A1").Value.Month(Date)
End If
End Sub
AND
Private Sub Workbook_Open()
If Format(Now(),"DD") = 1 Then
MsgBox("Same as above")
End If
End Sub
To explain, I would like a reminder to appear on the first day of
every
month but only the first time the workbook opens as I don't want
it to
annoy my end users.
Ta much for any help :)
Doo
|