<font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"> <span>Dear Lady/Sir,<br><br>My apologies to bother you with such insignificant thing. But I found nothing so far at internet to explain my mistake.<br>I learned VBA by my self. This means I don't have too much knowledge about programming.<br><br>Usually I make spreadsheets in Excel. But for now on, I'll have to use libreoffice as well.<br>I need to create a spreadsheet with conditional format. Lots of cells (over 300) with, at least 2 conditional formulas.<br><br>So I search lots at internet and found how to do it with libreoffice basic.<br>But something is wrong. Please look at example code below:<br><br>Sub Test<br>    Dim mCond (2) As New com.sun.star.beans.PropertyValue<br>    Dim oEntrys As Variant<br>    Dim oExtension as object<br>    Dim oDoc as object<br><br>    oDoc = ThisComponent<br><br>    oExtension = oDoc.getSheets().getByName("Test1").getCellRangeByPosition(0,5,0,5) 'A6<br><br>    oEntrys = oExtension.getPropertyValue("ConditionalFormat")<br><br>    mCond(0).Name = "Operator"<br>    mCond(0).Value = com.sun.star.sheet.ConditionOperator.FORMULA<br>    mCond(1).Name = "Formula1"<br>    mCond(1).Value = </span><span><span>"OR(B6>1;B6<7)"<br></span>    mCond(2).Name = "StyleName"<br>    mCond(2).Value = "Result"<br><br>    oEntrys.clear()<br>    oEntrys.addNew(mCond())<br>    oExtension.setPropertyValue("ConditionalFormat", oEntrys)<br>End Sub<br><br>So far, so good.<br><br>The formula, as you see, seems right and functional. But when I execute de script, in cell A5<br>the formula appears as "</span><span><span><span>OR(B11>1;B11<7)"</span></span> (print screen attached).<br><br>In original script I used a line counter like this: </span><span><span><span>"OR(B" & LineCounter & ">1;B" & LineCounter & "<7)".<br>The LineCounter starts at 6. When I watched the result in cell, I do not understand why 6 become 11.<br><br>So I used a string var 'Auxiliar' to mount and watch the result with step by step execution of script.<br>The formula value in 'Auxiliar' was right, just like in example code above.<br><br>I was using libreoffice 3.3.3. I thought maybe there was a bug at this version. I Uninstall it and install version 4.0.3.<br>Same thing happend.<br><br></span></span></span><span><span><span><span><span><span>I'm still searching (about 30 days so far) and found nothing!<br><br></span></span></span>Please, could tell me where is my mistake? <br><br></span></span>José Ramos<br>joseramos@bb.com.br</span></font> </font>