Hello Andrew, *, Andrew Douglas Pitonyak wrote:
> [...] Thanks for this note. I think you mean "Sub RetrieveTheActiveCell()" in AndrewMacro.odt. (In principle i know your book (by hentzenwerke plublishing), AndrewMacro.odt and AndrewBase.pdf - but you are right, i dont know this macro.) My problem is the selection after the detection of the active cell. Please have a look of my existing solution on the end of this post. In your code the problem is the same, after running the macro the selection ist not equal to the situation bevore running the macro. Exemple: I mark (by mouse) A1:A6 and D6:D13 and D17:G23 and the active cell is D17, i run the macro and the the selection is A1:A6 and D6:D13 and D17:G23 (thats correct) but the active cell after runnig the macro is A1 and not D17. What can i do? (OK, i think in principle it is possible to use .uno:JumpToNextUnprotected, and detect when the active cell is the right cell (in the example D17), but i think this is not elegant for great cellranges. Or is there another, simple solution, in this case i dont see this solution.) greetings, Jörg -- My Calc-Book: http://www.galileocomputing.de/1025 ------------------------------------------------- my code is: '... 'Problem ist das aktive Zelle innerhalb der Gesamtselektion nicht zu bestimmen ist 'wird jedoch gebraucht, weil Standardverhalten von Calc anders als Excel 'deshalb workaround 'Markierung zwischenspeichern rangetmp = ThisComponent.getCurrentSelection document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") dim args1(1) as new com.sun.star.beans.PropertyValue args1(0).Name = "By" args1(0).Value = 1 args1(1).Name = "Sel" args1(1).Value = false 'dispatcher nutzen um spezifische Zelle aus Range zu markieren If Not(rangetmp.supportsService("com.sun.star.sheet.SheetCellRanges")) Then if rangetmp.getRangeAddress.StartColumn = 0 Then dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args1()) dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args1()) Else dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args1()) dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args1()) End If Else tmpzelle = 1 For i = 0 To rangetmp.getCount()-1 if rangetmp(i).getRangeAddress.StartColumn = 0 Then tmpzelle = 0 Next i if tmpzelle = 0 Then dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args1()) dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args1()) Else dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args1()) dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args1()) End If End If 'nur eine Zelle markiert, aus dieser bedingte Formatierung lesen 'note: 'the important ist here ThisComponent.getCurrentSelection '.ConditionalFormat i only need for the rest of my macro bedingtes_format = ThisComponent.getCurrentSelection.ConditionalFormat 'wieder zwischengespeicherten Zellbereich markieren 'falls nicht nur eine Zelle markiert war If Not(rangetmp.supportsService("com.sun.star.sheet.SheetCell")) then ThisComponent.currentController.select(rangetmp) End If '... --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
