I tried to add conditional formats as follows:
If the expression =($G5<>""), then make the set green, use this for $ A $ 5: $ H $ 25.
I tried this, it worked fine, as expected, then I tried to adapt it as a VBA code with the following code, which works, but not as expected:
With ActiveSheet.UsedRange.Offset(1)
.FormatConditions.Delete
'set used row range to green interior color, if "Erledigt Datum" is not empty
With .FormatConditions.Add(Type:=xlExpression, _
Formula1:="=($" & cstrDefaultProgressColumn & _
.row & "<>"""")")
.Interior.ColorIndex = 4
End With
End With
The problem is .rowproviding the correct line during debugging, however my conditional formula added seems to be one or more lines depending on my decision to set the line. Therefore, I am ending conditional formatting, which has an offset to the string that needs to be formatted.
=($G6<>"") G3 G100310 - . G5.
, , , .
, With, .
edit: , UsedRange, :
Dim rngData As Range
Set rngData = ActiveSheet.Range("A:H") 'ActiveSheet.UsedRange.Offset(1)
rngData.FormatConditions.Delete
With rngData.FormatConditions.Add(Type:=xlExpression, _
Formula1:="=($" & cstrDefaultProgressColumn & _
1 & "<>"""")")
.Interior.ColorIndex = 4
End With
:
1 -> empty cells
2 -> empty cells
3 -> empty cells
4 -> TitleCols -> A;B;C;...;H
5 -> Data to TitleCols
. .
. .
. .
25
Excel 2007 =($G1048571<>"") - =($G1<>""), .
- , . , , , - , , ^^
:
, . , - , .
, , , , , , .
, NamedRanges DefaultProgessColumn.
GetTitleRow NamedRange .
With ActiveSheet.UsedRange.Offset(GetTitleRow(ActiveSheet.UsedRange) - _
ActiveSheet.UsedRange.Rows(1).row + 1)
1, , .
Formula1:="=(" & Cells(.row, _
Range(strMatchCol1).Column).Address(RowAbsolute:=False) & _
"<>"""")"
strMatchCol1 - .