Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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("")

rem ----------------------------------------------------------------------
dim args2(0) as new
args2(0).Name = "ToPoint"
args2(0).Value = "$D$65536"

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

dim args7(1) as new
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

You must log in to answer this question.

Browse other questions tagged .