Stock Data Auto Refresh in Excel

Occasional Contributor

Hey guys, anyone knows how to set auto refresh for the stock data in excel? I have tried using visual basic application with the coding below.

 

Sub Main()

ActiveWorkbook.RefreshAll

Call Refresh_Macro

End Sub

Private Sub Refresh_Macro()

Application.OnTime Now + TimeSerial(0, 0, 1), "Main"

End Sub

 

However, it does not work (You may refer to the below attached screenshot). I am not sure whether any error with the coding. Or anyone else know other alternative? 

Thank you. 

6 Replies

@Jesling Can't say much about the code, but the message you get suggest that you have not enable macros on your Mac. What setting do you use for Macro Security? If the first one, you will never get the chance to enable macros.

Screenshot 2021-11-19 at 08.08.52.png

Hey Riny, where can I get to access this macro security? I got no idea for this hehehe

@Jesling Top left of the screen, Excel, Preferences..., Security (bottom row, third icon).

Screenshot 2021-11-21 at 18.57.43.png

Hey Riny, I have already enabled it however the result is still the same, would it be any other reasons? Or do you know any alternatives can solve it?

@Jesling Don't know. Sorry!

@Riny, No worries. Thank you so much for your response