AW: Formeländerungen in History eintragen
02.03.2012 20:57:28
ransi
HAllo
Wenn du jede Zelle einzeln abfragst hast du eine echte Historie.
Dann einfach einen Filter in Spalte A gesetzt und die vorherigen Werte abfragen.
Teste mal selber "auf Herz und Nieren":
' **********************************************************************
' Modul: DieseArbeitsmappe Typ: Element der Mappe(Sheet, Workbook, ...)
' **********************************************************************
Option Explicit
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim LoLetzte As Long, Zelle As Range, Bereich As Range, Arr As Variant, L As Long
Dim Netzwerk As Object
If Not Sh Is Sheets("History") Then
Set Netzwerk = CreateObject("wscript.network")
Application.EnableEvents = False
Redim Arr(1 To Target.Cells.Count, 1 To 9)
For Each Bereich In Target.Areas '
For Each Zelle In Bereich.Cells
L = L + 1
Arr(L, 1) = Zelle.Address
Arr(L, 2) = Zelle.Text
Arr(L, 3) = "'" & Zelle.FormulaLocal
Arr(L, 4) = Sh.Name
Arr(L, 5) = Environ("Username")
Arr(L, 6) = CStr(Date)
Arr(L, 7) = CStr(Time)
Arr(L, 8) = Netzwerk.computername
Arr(L, 9) = Netzwerk.UserName
Next
Next
With Worksheets("History")
LoLetzte = IIf(IsEmpty(.Cells(.Rows.Count, 1)), .Cells(Rows.Count, 1).End(xlUp).Row, .Rows.Count) + 1
.Cells(LoLetzte, 1).Resize(UBound(Arr), 9) = Arr
End With
Application.EnableEvents = True
End If
End Sub
ransi