Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.