ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook_Open() error (https://www.excelbanter.com/excel-programming/276955-workbook_open-error.html)

Ruan[_3_]

Workbook_Open() error
 
Hello,

The below code works great, but I have to access the code
to modify the DateValue every now and again. I tried to
create a Named Range (A1) called Expiration_Date, but I
receive an error. What am I doing wrong?

This gives me an error
If Now = DateValue("Expiration_Date") Then


This works, but I would like to call the date from cell A1
Private Sub Workbook_Open()
ThisWorkbook.Unprotect Password:="1234"
If Now = DateValue("11/01/2003") Then
Worksheets("Oct").Visible = False
Else
Worksheets("Oct").Visible = True
End If
ThisWorkbook.Protect Password:="1234", _
Structu=True, Windows:=False
End Sub

Thanks
Ruan

Bob Phillips[_5_]

Workbook_Open() error
 
Ruan,
Try

If Now = DateValue(Range("Expiration_Date")) Then


--

HTH

Bob Phillips

"Ruan" wrote in message
...
Hello,

The below code works great, but I have to access the code
to modify the DateValue every now and again. I tried to
create a Named Range (A1) called Expiration_Date, but I
receive an error. What am I doing wrong?

This gives me an error
If Now = DateValue("Expiration_Date") Then


This works, but I would like to call the date from cell A1
Private Sub Workbook_Open()
ThisWorkbook.Unprotect Password:="1234"
If Now = DateValue("11/01/2003") Then
Worksheets("Oct").Visible = False
Else
Worksheets("Oct").Visible = True
End If
ThisWorkbook.Protect Password:="1234", _
Structu=True, Windows:=False
End Sub

Thanks
Ruan




Ruan[_3_]

Workbook_Open() error
 
Thanks Bob,

That works great.


-----Original Message-----
Ruan,
Try

If Now = DateValue(Range("Expiration_Date")) Then


--

HTH

Bob Phillips

"Ruan" wrote in message
...
Hello,

The below code works great, but I have to access the

code
to modify the DateValue every now and again. I tried to
create a Named Range (A1) called Expiration_Date, but I
receive an error. What am I doing wrong?

This gives me an error
If Now = DateValue("Expiration_Date") Then


This works, but I would like to call the date from cell

A1
Private Sub Workbook_Open()
ThisWorkbook.Unprotect Password:="1234"
If Now = DateValue("11/01/2003") Then
Worksheets("Oct").Visible = False
Else
Worksheets("Oct").Visible = True
End If
ThisWorkbook.Protect Password:="1234", _
Structu=True, Windows:=False
End Sub

Thanks
Ruan



.



All times are GMT +1. The time now is 08:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com