Statt Cells(x,x) ActiveCell eingeben

  • #1
N

nok106

Bekanntes Mitglied
Themenersteller
Dabei seit
10.09.2005
Beiträge
108
Reaktionspunkte
0
Ort
Brunsbüttel
Hallo Leute,

kann der folgende Code evtl. geändert werden, statt Cells(x,x) in ActiveCell ?

Damit könnte man doch dann eine xbeliebige Zelle zur Eingabe auswählen !!!

Ist es machtbar ?

Wenn Ja , dann bitte ich um Hilfe.


Code:
Sub daten() 
Cells(1, 1) = Erstellt am  & ActiveWorkbook.BuiltinDocumentProperties(11).Value 
Cells(2, 1) = Zuletzt gedruckt am  & ActiveWorkbook.BuiltinDocumentProperties(10).Value 
Cells(3, 1) = Zuletzt gespeichert am  & ActiveWorkbook.BuiltinDocumentProperties(12).Value 
End Sub
 
  • #2
Jo
Code:
Sub daten()
  ActiveCell.Offset(0, 0) = Erstellt am  & ActiveWorkbook.BuiltinDocumentProperties(11).Value
  ActiveCell.Offset(1, 0) = Zuletzt gedruckt am  & ActiveWorkbook.BuiltinDocumentProperties(10).Value
  ActiveCell.Offset(2, 0) = Zuletzt gespeichert am  & ActiveWorkbook.BuiltinDocumentProperties(12).Value
End Sub
Gruß Matjes  :)
 
  • #3
Hallo Matjes,

für deine Antwort besten Dank.

Zwischenzeitlich habe ich mir den folgenden Code zusammen gewurschtelt,
damit kann ich nun an einer xbeliebigen Stelle in der Arbeitsmappe den Zeitstempel setzen.

Eingabe: =erstellt() oder =geändert() oder =gedruckt()
Anzeige: Datum und Uhrzeit.

Dazu hätte ich noch ne' Frage:
Ist es im Code machbar dass man die Uhrzeit ausblendet, so dass nur das Datum angezeigt wird ?

Code:
Option Explicit

Function Erstellt() As String
Erstellt = Erstellt am  & ActiveWorkbook.BuiltinDocumentProperties(11)
End Function

Function Geändert() As String
Geändert = Zuletzt geändert am  & ActiveWorkbook.BuiltinDocumentProperties(12)
End Function

Function Gedruckt() As String
Gedruckt = Zuletzt gedruckt am  & ActiveWorkbook.BuiltinDocumentProperties(10)
End Function
 
  • #4
Hallo nok106,

ich hab die Functions etwas angepasst. Wenn es zum Beispiel noch kein Druckdatum gibt ....  gibts sonst #WERT.

Die Functions kannst Du wie andere Formel-Elemente auch einfügen.
Sie sind in der Formel-DropDown-Liste unter->weitere Funktionen->benutzerdefiniert' zu finden. Dann brauchst Du nicht tippen   ;)

Die zusätzliche Sub BuiltInDocPropertiesBezeichnungZuNr() gibt dir zur Nr die Bezeichnungen/Namen der BuiltInDocProperties aus.

Es sind standardmäßig aber nicht alle belegt (zumindest in der deutschen Version) wegen Datenschutz.

Gruß Matjes :)
Code:
Option Explicit
'********************************************************
Sub BuiltInDocPropertiesBezeichnungZuNr()
  Dim sMldg As String
  Dim lAnz As Long, lAnzProMldg As Long, lAnzMldg As Long
  Dim x As Long, y As Long, lNr As Long
  
  lAnz = ActiveWorkbook.BuiltinDocumentProperties.Count
  lAnzProMldg = 10
  lAnzMldg = lAnz \ lAnzProMldg
  If lAnz Mod lAnzProMldg > 0 Then lAnz = lAnz + 1
  For x = 0 To lAnzMldg - 1
    sMldg = _
      BuiltInProperties & vbLf & vbLf & _
      Nr  Bezeichnung & vbLf
    For y = 1 To lAnzProMldg
      lNr = (x * lAnzProMldg) + y
      If (lNr > lAnz) Then
        MsgBox sMldg
        Exit For
      End If
      sMldg = sMldg & Format(lNr, 00) &    & _
              ActiveWorkbook.BuiltinDocumentProperties(lNr).Name & vbLf
      If (y = lAnzProMldg) Then
        MsgBox sMldg
        Exit For
      End If
    Next
  Next
  
End Sub
'********************************************************
Function Erstellt_MitUhrzeit() As String
  Erstellt_MitUhrzeit = _
  Erstellt am  & ActiveWorkbook.BuiltinDocumentProperties(11)
End Function
'********************************************************
Function Erstellt_OhneUhrzeit() As String
  Dim dDate As Date
  dDate = ActiveWorkbook.BuiltinDocumentProperties(11)
  Erstellt_OhneUhrzeit = _
  Erstellt am  & Format(dDate, dd.mm.yyyy)
End Function
'********************************************************
Function Geaendert_MitUhrzeit() As Variant
  Dim dDate As Date
  On Error Resume Next
  dDate = ActiveWorkbook.BuiltinDocumentProperties(12)
  If Err.Number <> 0 Then
    Err.Clear
    Geaendert_MitUhrzeit = nicht geändert
  Else
    Geaendert_MitUhrzeit = Zuletzt geändert am  & dDate
  End If
  On Error GoTo 0
End Function
'********************************************************
Function Geaendert_OhneUhrzeit() As Variant
  Dim dDate As Date
  On Error Resume Next
  dDate = ActiveWorkbook.BuiltinDocumentProperties(12)
  If Err.Number <> 0 Then
    Err.Clear
    Geaendert_OhneUhrzeit = nicht geändert
  Else
    Geaendert_OhneUhrzeit = _
    Zuletzt geändert am  & Format(dDate, dd.mm.yyyy)
  End If
  On Error GoTo 0
End Function
'********************************************************
Function Gedruckt_MitUhrzeit() As Variant
  Dim dDate As Date
  On Error Resume Next
  dDate = ActiveWorkbook.BuiltinDocumentProperties(10)
  If Err.Number <> 0 Then
    Err.Clear
    Gedruckt_MitUhrzeit = nicht gedruckt
  Else
    Gedruckt_MitUhrzeit = Zuletzt gedruckt am  & dDate
  End If
  On Error GoTo 0
End Function
'********************************************************
Function Gedruckt_OhneUhrzeit() As Variant
  Dim dDate As Date
  On Error Resume Next
  dDate = ActiveWorkbook.BuiltinDocumentProperties(10)
  If Err.Number <> 0 Then
    Err.Clear
    Gedruckt_OhneUhrzeit = nicht gedruckt
  Else
    Gedruckt_OhneUhrzeit = _
    Zuletzt gedruckt am  & Format(dDate, dd.mm.yyyy)
  End If
  On Error GoTo 0
End Function
 
  • #5
Hi Matjes,

ich bin baff, danke für deine exzellente Ausführung.

Aber trotz allem, ich bin nur ein kleiner Excelbastler drum untenstehendes Zitat.
Stehe auf' Schlauch, finde die gekennzeichnete Liste nicht.

Die Functions kannst Du wie andere Formel-Elemente auch einfügen.
Sie sind in der Formel-DropDown-Liste unter->weitere Funktionen->benutzerdefiniert' zu finden. Dann brauchst Du nicht tippen
 
  • #6
Hallo nok106,

in der Berabeitungs-Leiste ist links eine Drop-Down-Liste. Die zeigt gewöhnlich die Adresse der markierten Zelle. Wenn du den Button->=' drückst, also eine Formel in die Bearbeitungs-Leiste eingeben willst, werden als Inhalt dieser drop-Down-Liste alle Formel-Funktionen zur Auswahl angeboten.

Und dort wie beschrieben weiter ...

Gruß Matjes :)
 
  • #7
Hallo Matjes,

alles paletti, Dankeschön und noch einen schönen Sonntagabend.
 
Thema:

Statt Cells(x,x) ActiveCell eingeben

ANGEBOTE & SPONSOREN

Statistik des Forums

Themen
113.840
Beiträge
707.963
Mitglieder
51.494
Neuestes Mitglied
Flensburg45
Oben