Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Does anyone know how to sort via a macro ? I want the user to be able to use a button to sort. The field to sort on is hidden. I tried
sub Sort
set chart1 = ActiveDocument.GetSheetObject("CH121")
chart1.SortBy 24
end sub
which works as long as the column is not hidden but if it's hidden it fails. I think I need to sort on the field name rather than the column no but I don't know how to do this. Can anyone help ?
Hi,
In the chart order move the expression first and try the below macro:
Sub SortOrder
Set chart = ActiveDocument.GetSheetObject("CH121")
Set p = chart.GetProperties
p.Expressions.Item(1).Item(0).Data.ExpressionData.SortCriteria.SortByNumeric = 1
chart.SetProperties p
End Sub
Regards,
Kiran Rokkam.
Thanks for this Kiran. This doesn't work unfortunately. It doesn't give an error - it just doesn't sort.Not sure what is wrong here.
What I did was to have the hidden field displayed but with a column width of zero. That way my sort macro works and the column is not seen. It's not as neat as being able to sort on a hidden field but the the end result is the same.
Can you share your file?
Regards,
Kiran Rokkam.
Just check this out.
Kiran.
Thanks Kiran. It's appreciated. I'll look at this shortly as I'm on holiday for a while... .