Date to stop macro

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
614
Hi I have an bill data macro in excel 2007, I just want a code, if any person click on the Run button, the macro should not run

eg:- if in the system date is 10 Feb 2013 and any person clicks on the run button the macro should not run.

Thanks.
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

ChrisR

Well-known Member
Joined
Dec 21, 2012
Messages
848
Hi,

What is the criteria? What relevance is 10 Feb 2013?

Where is this date stored? Does this mean that you have reports whereby the date is blank or a future date? So, in effect, you are comparing a date in a cell against the current date?

Is this correct? You will need to provide further details in order to get a resolution.

Thanks
 

ChrisR

Well-known Member
Joined
Dec 21, 2012
Messages
848
P.s. If you did just want to compare a cell to todays date you could use something simple like this

If Range("A1").Value<Date Then
Exit Sub
Else
*** Enter Macro code here***
End if
End Sub
 

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
614
we need to pick the date form the system. as my macro do not have any date column or so

I have fig it as

this

on the workbook open

If Now() >= "20/01/2014 00:00:00" Then
Worksheets("Ubsoft").OLEObjects("CommandButton1").Enabled = False
End If
Worksheets("Ubsoft").OLEObjects("CommandButton1").Enabled = True
End Sub
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,127,537
Messages
5,625,394
Members
416,100
Latest member
lirongr1996

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
Top