Simple request: I have calc sheets with multiple tables of data, needing to be sorted by values I have defined (this UserDefIndex is all set)? I am hoping to find a way to write the Macro that will perform this sort on the cells I have highlighted, as opposed to an absolute cell address
I have wandered through each of these, however, the nomenclature is just too obtuse, and I am having difficulty gaining any grasp of the code
https://opensource.com/article/18/2/variables-data-types-libreoffice-basic
sub sorts_stats rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object
rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "ToPoint" args1(0).Value = "$A$3:$D$18"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
How do I define an area of highlighted cells, as opposed to "$A$3:$D$18", since the size of the range will vary?
You can select the range manually, then get the selection range
Doc = ThisComponent
Sheet = Doc.Sheets(0)
rng = Doc.CurrentSelection