Reputation: 5442
Hi I am using Excel to fetch live data from web into an Excel sheet and pushing it into a SQL Server Database using macro. The macro code is executing manually. The Excel sheet data gets refreshed every minute. I have to run this macro when the data gets refreshed from the web into the sheet. Can somebody please help me to understand how to do this?
Upvotes: 0
Views: 1791
Reputation: 17637
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Call MyOtherSub
Application.EnableEvents = True
End Sub
You can drop this in the worksheet module for the sheet being changed. Note the .EnableEvents
statements - these are very important in ensuring you don't wind up in an infinite loop if your called procedure changes something.
Upvotes: 1
Reputation: 566
how about stopping auto refresh from web and put it as part of the macro?
or try adding the macro for worksheet change, explained here - How to run a macro when certain cells change in Excel
Upvotes: 2