1

I'm trying to test each cell in column 0 "A" to see if it has specific text "Budget" "Living" "Savings" and if it does then change the row background color to a specific color for each.

I am able to determine the last row with text, but can not test column "A". I have attached the code below for as far as I have gotten.

sub FindLastRow
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
dim oSheet
Dim oCell 
Dim x

rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ToPoint"
args2(0).Value = "$D$65536"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())

dim args7(1) as new com.sun.star.beans.PropertyValue
args7(0).Name = "By"
args7(0).Value = 1
args7(1).Name = "Sel"
args7(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoUpToStartOfData", "", 0, args7())
dim oActiveCell 
dim oConv
oActiveCell = ThisComponent.CurrentSelection
x = oActiveCell.getCellAddress().Row

print x

Cell.String = "a" & oActiveCell.getCellAddress().Row
Cell.string = "budget"

print Cell.string

if cell.string="Budget" then
print x
end if

0

You must log in to answer this question.

Browse other questions tagged .