ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run a Macro just after i open a workbook EXCEL (https://www.excelbanter.com/excel-programming/411396-run-macro-just-after-i-open-workbook-excel.html)

[email protected]

Run a Macro just after i open a workbook EXCEL
 
Hi Guys,

i want to trigger a macro just after i open my workbook in EXCEL with
the condition that if value of cell B1 is equal to todays date trigger
the macro and written the below code.

Private Sub Workbook_Open()
MsgBox Date
If Worksheets("Sheet1").Range("B1").Value = Date Then
My_Macro
End If
End Sub

But it does not seems to be work.

Any advice or help will be appriciated.

Thanks

KAKA

Dave Peterson

Run a Macro just after i open a workbook EXCEL
 
What's in B1?

If you have date and time, you'll have to ignore the time:

If int(Worksheets("Sheet1").Range("B1").Value) = Date Then

Did you put the procedure in the ThisWorkbook module?

Did you allow macros to run?

Were events enabled when you opened the workbook?




wrote:

Hi Guys,

i want to trigger a macro just after i open my workbook in EXCEL with
the condition that if value of cell B1 is equal to todays date trigger
the macro and written the below code.

Private Sub Workbook_Open()
MsgBox Date
If Worksheets("Sheet1").Range("B1").Value = Date Then
My_Macro
End If
End Sub

But it does not seems to be work.

Any advice or help will be appriciated.

Thanks

KAKA


--

Dave Peterson


All times are GMT +1. The time now is 11:23 AM.

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