gibt es eine Möglichkeit alle Formeln in einer Datei zu löschen, wenn ein bestimmtes Ereignis (zB Datum abgelaufen) vorrüber ist? Könnte es mir auch mit einer Passwort abfrage vorstellen.
gruß Andreas
Sub FormelnLöschen()
Dim Bereich As Range, intL As Integer, strDatum As String
strDatum = "01.05.2008" ' Datum, das abgelaufen sein muss
If Date > DateValue(strDatum) Then
intL = LetzteZeile(ActiveSheet, 1) 'ermittelt die letzte gefüllte Zelle in Spalte 1
Set Bereich = ActiveSheet.Range(Cells(1, 1), Cells(intL, 10))
For Each zelle In Bereich
If zelle.HasFormula Then
zelle.ClearContents 'Inhalt der Zelle wird gelöscht
End If
Next zelle
End If
End Sub
Function LetzteZeile(objWS As Object, byteCol As Byte)
If IsEmpty(objWS.Cells(Rows.Count, byteCol)) Then
LetzteZeile = objWS.Cells(Rows.Count, byteCol).End(xlUp).Row
Else
LetzteZeile = Rows.Count
End If
End Function
Sub b()
Dim retInputbox
retInputbox = Application.InputBox("Formeln weghauen?")
If retInputbox "andreas" Then Exit Sub
On Error Resume Next
With ActiveSheet.UsedRange.SpecialCells(xlCellTypeFormulas)
.Value = .Value
End With
On Error GoTo 0
End Sub
Grüße Gerd