ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Running VBA Macro (https://www.excelbanter.com/excel-discussion-misc-queries/13165-running-vba-macro.html)

Jeff

Running VBA Macro
 
Hello,

It is possible to trigger a VBA macro that would run automatically every
time the workbook "A" is open, if the date in Workbook "A" in row D15 is
equal to the date in Workbook "B" E5?


Bob Phillips

Sub Auto_Open()
Dim wb As Workbook

On Error Resume Next
Set wb = Workbooks("Workbook B.xls")
On Error GoTo 0
If wb Is Nothing Then
MsgBox "Workbook B not open"
Else
If ThisWorkbook.ActiveSheet.Range("D15").Value = _
wb.ActiveSheet.Range("E5").Value Then
'run macro
End If
End If
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jeff" wrote in message
...
Hello,

It is possible to trigger a VBA macro that would run automatically every
time the workbook "A" is open, if the date in Workbook "A" in row D15 is
equal to the date in Workbook "B" E5?





All times are GMT +1. The time now is 10:01 PM.

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