Date to stop macro

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
612
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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

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
612
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,126,923
Messages
5,621,621
Members
415,848
Latest member
LCC

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