Excel 2010 makro zum markieren der Zeile der aktiven Zelle

Ich versuche, das folgende makro verwenden, aber es ist noch nicht einmal erkennen es als makro, so dass ich das makro nicht ausführen. Wenn ich die erste gerne nur die "private/public sub test()" wird ausgeführt, aber dann heißt es mein Ziel-Objekt ist nicht definiert.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
Application.ScreenUpdating = False
' Clear the color of all the cells
Cells.Interior.ColorIndex = 0
With Target
    ' Highlight the entire row and column that contain the active cell
    .EntireRow.Interior.ColorIndex = 8
    .EntireColumn.Interior.ColorIndex = 8
End With
Application.ScreenUpdating = True
End Sub
Stellen Sie sicher, dass Ihr code angefügt ist ein Blatt, das verwendet ein standard-Ereignis für Tabellenblätter.

InformationsquelleAutor MBlackburn | 2012-09-18

Schreibe einen Kommentar