VBA Format Conditions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anybody tell me why I get the error message 'Expected: =' at the .Add
line? Thanks! h is a defined range of cells. I'm trying to conditionally
format several cells so that if they are greater than the cell two columns to
the left of them, the font will be green.

With h.FormatConditions
.Delete
.Add(xlCellValue, xlGreater, ActiveCell.Offset(0, -2))
End With
 
Mark,

You don't use the parens with the .Add unless you want to set a variable
equal to the returned value.

Also, you need to pass a valid cell address to the .Add, not the cell
itself:

With h.FormatConditions
.Delete
.Add xlCellValue, _
xlGreater, _
"=" & h(1, -1).Address(False, False)
End With

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top