Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Sokkorn
Master
Master

How to create Macro to sort Y-value?

Hi All,

Can anyone help me how to create macro to sort Y-value in chart according user click on button (Ascending and Decending)?

Regards,

Sokkorn

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

   Here is a macro to toogle between asc and des sort on y axis of a chart.

sub sort

set chart = ActiveDocument.GetsheetObject("CH02")
set p = chart.GetProperties
if p.SortByYValue = -1 then
p.SortByYValue = 1             'ascending
elseif p.SortByYValue = 1 then
p.SortByYValue = -1            'Desending
End if       

chart.SetProperties p

end sub

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

3 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

   Here is a macro to toogle between asc and des sort on y axis of a chart.

sub sort

set chart = ActiveDocument.GetsheetObject("CH02")
set p = chart.GetProperties
if p.SortByYValue = -1 then
p.SortByYValue = 1             'ascending
elseif p.SortByYValue = 1 then
p.SortByYValue = -1            'Desending
End if       

chart.SetProperties p

end sub

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Sokkorn
Master
Master
Author

Hi Kaushik,

Thanks for your help. It working fine.

Regards,

Sokkorn

Not applicable

Hi Kaushik

I need your help very very urgently. After seeing this post I thought that you can help me out in the below post.

http://community.qlik.com/message/157797#157797

Thanks

Attitude