I am refreshing external data automatically to Sheet 1(query), I want the refresh to trigger a macro: can you show me the entire code, I don't know VBA to well please
reckoning on your version of place of work, via fact the previous poster observed, having macros run whilst a workbook opens could be tricky. via default Excel would not enable macros to run without the consumer specially allowing them. you are able to enable that habit via enhancing macro protection and allowing all macros to run, yet that it incredibly no longer reported. you may desire to attempt putting a message on the 1st worksheet and then enhancing that message as quickly as macro are enabled via the consumer, yet that could desire to require placing the message lower back on the workbook close experience.
Answers & Comments
Verified answer
Since i don't have the code that refresh the query to sheet1, i can only provide a couple of general ways to achieve your goal
1. add the macro and put the macro name at the last line of the Sub that do the query
e.g.
Sub RefreshSheet1Query()
<original code to refresh the query>
Call MyMacro
End Sub
Sub MyMacro()
<code that do something after the RefreshSheet1Query is done>
End Sub
2. add lines of code at the start and at the end of RefreshSheet1Query, to monitor change before and after refreshing query
e.g. if Cell A1 changed after query refresh, MyMacro will run
Sub RefreshSheet1Query()
Dim b4chg
b4Chg = Range("A1")
<original code to refresh the query>
If b4Chg <> Range("A1") Then Call MyMacro
End Sub
Sub MyMacro()
<code that do something after the RefreshSheet1Query is done>
End Sub
Please contact for more info.
reckoning on your version of place of work, via fact the previous poster observed, having macros run whilst a workbook opens could be tricky. via default Excel would not enable macros to run without the consumer specially allowing them. you are able to enable that habit via enhancing macro protection and allowing all macros to run, yet that it incredibly no longer reported. you may desire to attempt putting a message on the 1st worksheet and then enhancing that message as quickly as macro are enabled via the consumer, yet that could desire to require placing the message lower back on the workbook close experience.