I've read lots of other posts (particularly this) and even tried to replicate a few and I don't understand what's wrong.
I'm trying to get a function to run after the spreadsheet has been refreshed. It seems that I have to mess around with query tables, though if there is some way that I can avoid that, please tell me. I've attached what I think are the relevant code snippets (though I could have missed some).
The error I get is runtime eror: '9' Subscript out of range
code in "this workbook"
Dim qtevent As qtClass Private Sub Workbook_Open() Set qtevent = New qtClass Set qtevent.HookedTable = ThisWorkbook.Worksheets("REFRESH SHEET").ListObjects(1).QueryTable MsgBox "Qt Events Run" End Sub
Code in class qtClass
Option Explicit Private WithEvents qt As Excel.QueryTable Public Property Set HookedTable(q As Excel.QueryTable) Set qt = q End Property Private Sub qt_AfterRefresh(ByVal Success As Boolean) MsgBox "qt_AfterRefresh called sucessfully." If Success = True Then MsgBox "If called succesfully." End If End Sub