Alle Zellen mit Kommentaren farblich markieren
29.04.2002 11:46:36
Ralph P.
Ich möchte in einer Excel-Tabelle alle Zellen farblich markieren, die einen Komentar enthalten. Mein Ansatzt ist dieser:
Sub mark()
laRow = Cells(Rows.Count, 1).End(xlUp).Row
laCol = Cells(Columns.Count).End(xlToLeft).Column
For col = 1 To laCol
For Row = 1 To laRow
Cell = col & Row
Cells(Row, col).Select
adr = ActiveWindow.RangeSelection.Address
adr1 = Replace(adr, "$", "")
If Range(adr1).Comment.Text = "" Then
GoTo weiter
Else
Cells(Row, col).ColorIndex = 6
Cells(Row, col).Pattern = xlSolid
weiter:
End If
Next Row
Next col
End Sub
Funktioniert aber nicht. Excel bringt den Fehler 91 : Objektvariable oder With-Blockvariable nicht festgelegt