ich möchte per Makro alle nicht gesperrten Zellen in dem aktuellen Blatt auswählen und den Inhalt löschen.
Gibt es hier für eine Lösung ?
Danke.
Sub Loeschen_nicht_gesperrt()
Dim wks as Worksheet, Zelle as Range
Set wks = Activesheet
For Each Zelle in wks.Usedrange.Cells
If Zelle.Locked = False Then
Zelle.ClearContents
End if
Next
GrußSub Makro2()
Dim Z
For Each Z In Sheets("Tabelle1").Cells.SpecialCells(xlCellTypeConstants, 3)
If Z.Locked Then Z.ClearContents
Next
End Sub
VBA/HTML-CodeConverter, AddIn für Office 2002-2016 - in VBA geschrieben von Lukas Mosimann. Projektbetreuung:RMH Software & Media
Code erstellt und getestet in Office 15 - mit VBAHTML 12.6.0
Sub Makro2()
Dim Z
For Each Z In Sheets("Tabelle1").Cells.SpecialCells(xlCellTypeConstants, 3)
If Z.Locked = False Then Z.ClearContents
Next
End Sub
VBA/HTML-CodeConverter, AddIn für Office 2002-2016 - in VBA geschrieben von Lukas Mosimann. Projektbetreuung:RMH Software & Media
Code erstellt und getestet in Office 15 - mit VBAHTML 12.6.0
LG UweDSub Makro9()
Dim Z
ActiveSheet.Unprotect "jg"
For Each Z In ActiveSheet.Cells.SpecialCells(xlCellTypeConstants, 3)
If Z.Locked = False Then Z.ClearContents
Next
ActiveSheet.Protect "jg"
End Sub
dim Bereich as range
dim Zelle as range
for each Zelle in ActiveSheet.UsedRange
if Zelle.Locked = False Then
If Bereich is Nothing then
Set Bereich = Zelle
Else
Set Bereich = Union(Bereich, Zelle)
end if
end if
Next
if not Berich is Nothing then Bereich.Select
Gruß DanielSub aaa()
Dim c As Range, cs As Range
For Each c In Cells.SpecialCells(xlCellTypeConstants)
If Not c.Locked Then
If cs Is Nothing Then
Set cs = c.MergeArea
Else
Set cs = Union(cs, c.MergeArea)
End If
End If
Next
If Not cs Is Nothing Then cs.Select
End Sub
Gruß