If Date question

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
1,124
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I'm working with this code below that I've pasted into Sheet1 of my workbook:


Code:
Private Sub Workbook_Expired()
 
    With ThisWorkbook.Sheets("Sheet1")
        If Date > (.Range("D3") + 3) Then
            
   
 MsgBox "This Sheet has expired!"
   
        End If
    End With
 
End Sub


I'd like to add this code to include:


Code:
If IsEmpty(Sheet1.Range("D3").Value) Then [QUOTE]Do nothing[/QUOTE]


If someone can help me, I'd appreciate it!

Thanks,
Pinaceous
 
Last edited:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Try this:
Code:
Private Sub CommandButton1_Click()
'Modified 4-2-18 9:40 PM EDT
    With ThisWorkbook.Sheets("Sheet1")
        If IsEmpty(Sheet1.Range("D3")) Then: Exit Sub
        If Date > .Range("D3") + 3 Then MsgBox "This Sheet has expired!"
    End With
 
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top