Running VBA Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top