Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Anita Morales   on Sep 30 In MS Office Category.

  
Question Answered By: Fergus Jones   on Sep 30

Thats' very surprising. I went and tested this on a Excel 2000/win2k
machine abd it worked just fine, all solutions proffered did. Here is
the code I used, with various versions commented out:

Sub blah()
sgR = "R"
sgC = "C"
cgDQ = """"
Range("D6").Select
ActiveCell.Offset(0, 6).FormulaR1C1 = _
"=if(" & sgR & sgC & "[-2]=" & sgR & sgC & "[-1]" _
& "," & cgDQ & cgDQ _
& "," & sgR & sgC & "[-2] -" & sgR & sgC & "[-1])"

'With ActiveCell.Offset(0, 6) 'Lisa's original
'.FormatConditions.Delete
'.FormatConditions.Add _
'Type:=xlCellValue, _
'Operator:=xlNotEqual, _
'Formula1:=cgDQ & cgDQ
'.FormatConditions(1).Font.ColorIndex = 3
'.FormatConditions(1).Interior.ColorIndex = 6
'End With


'With ActiveCell.Offset(0, 6) 'my 1st offering
'.FormatConditions.Delete
'.FormatConditions.Add _
' Type:=xlExpression, _
' Formula1:="=LEN(INDIRECT(ADDRESS(ROW(),COLUMN())))"
'.FormatConditions(1).Font.ColorIndex = 3
'.FormatConditions(1).Interior.ColorIndex = 6
'End With


'With ActiveCell.Offset(0, 6) 'my 2nd offering
'.FormatConditions.Delete
'.FormatConditions.Add _
' Type:=xlExpression, _
' Formula1:="=len(" & .Address & ")"
'.FormatConditions(1).Font.ColorIndex = 3
'.FormatConditions(1).Interior.ColorIndex = 6
'End With

With ActiveCell.Offset(0, 6) 'David's solution
.FormatConditions.Delete
.FormatConditions.Add _
Type:=xlCellValue, _
Operator:=xlNotEqual, _
Formula1:="=" & cgDQ & cgDQ
.FormatConditions(1).Font.ColorIndex = 3
.FormatConditions(1).Interior.ColorIndex = 6
End With
End Sub

Share: 

 

This Question has 16 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Excel 2000 Conditional formatting Or get search suggestion and latest updates.


Tagged: