Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro to check if a particular column in a straight table or pivot table is clicked

Hi,

I would like to create a macro to check if a particular column in a straight table or in a pivot table is clicked. If clicked, I would like to go to another sheet. I have created below macro but can't seem to make it work. I think I'm missing the logic to check if column is clicked from this statement -- ActiveDocument.GetSheetObject("CH01").activate


sub sheet2
if ActiveDocument.GetSheetObject("CH01").activate then
ActiveDocument.Sheets("Sheet2").activate
end if
end sub


2 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Yes, "Activate" is the API that causes the automatic activation of a certain object.

I don't think there is an API that returns the specific column that was clicked on. At best, you can trigger an Action (Ver. 9.00) or a Macro (ver. 8.x) when the Object is clicked on. Alternatively, if the column structure of the Straight table is fairly static, you can overlay transparent buttons over each Column, with different Macros (Actions) related to each button...

good luck!

Not applicable
Author

Thank you for your response.

I did try triggering an action (OnSelect through External-Run Macro or Layout-Activate Sheet) and it works fine. However, when clicking the "Clear All" button, it triggers the macro to run which I do not want, this is the primary reason why I need to check which certain column is clicked on. Embedding transparent buttons may also not be an ideal solution as the column structure is dynamic.