This Macro is running fine for the B2 Cell as its hidng the cells, but now i stuck with the next cell B3 .Even for the B3 cell i wanted the condition should hide the cells.I am attaching the code sample also.
- Code: Select all Expand viewCollapse view
Sub EventListenerOn
'Dim oSheet As Object
oDoc=ThisComponent
oSheet = oDoc.Sheets(0)
oGroup=oSheet.getCellRangeByName("B1:B7")
'--- installation of an event listener
'oListener = createUnoListener("OOO_","com.sun.star.lang.XEventListener")
oListener = createUnoListener("OOO_","com.sun.star.chart.XChartDataChangeEventListener")
oGroup.addChartDataChangeEventListener(oListener)
End Sub
Sub EventListenerOff
oGroup.removeChartDataChangeEventListener(oListener)
End Sub
Sub OOO_chartDataChanged
dim flt as Object
oDoc = ThisComponent
oSheets = oDoc.getSheets()
oSheet = oSheets.getByName("Sheet1")
oGroup = oSheet.getCellRangeByName("B2")
If oGroup.String="Yes" Then
For i = 2 to 11
oSheet.Rows(i).isVisible = False
Next i
End if
If oGroup.String="No" Then
For i = 2 to 14
oSheet.Rows(i).isVisible = False
Next i
End If
If oGroup.String="Not in ODC palce" Then
For i = 2 to 14
oSheet.Rows(i).isVisible = True
Next i
End If
End Sub
Thanks for the help.