View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Including a variable into formatconditions

Formula1:="=AND(" & Cells(rowindex,columnindex).Address(0,0) & "=1)"

--
Regards,
Tom Ogilvy


"Chris" wrote in message
...
I am trying to convert the cell reference in the formula1 from a specific
cell to a program selected cell;

B391 to cells(rowindex,columnindex)

(actual code)
Range("B996:Y998").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=AND(B391=1)"

everything I try turns into an error

Selection.FormatConditions(1).Interior.Pattern = xlGrid