Live-Forum - Die aktuellen Beiträge
Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

userform datum

Forumthread: userform datum

userform datum
rolf
hallo
mit diesem makro überttrage ich den inhalt einer userform in eine tabelle.
Jetzt möchte ich das mit der txtbox 86 automatisch das aktuelle datum üertragen wird,wenn die zelle leer ist.
bekomme es leider ohne eure hilfe nicht hin.
gruß rolf
Private Sub btn_eintragen_Click()
Dim ctl As Control
Dim wohin As Integer
wohin = Sheets("Liste").Range("B8000").End(xlUp).Offset(1, 0).Row
wohin = Me.ListBox1.ListIndex + 1
With Sheets("Abstammungen")
On Error Resume Next
.Cells(wohin, 1) = Format(TextBox1.Text)
.Cells(wohin, 2) = Format(TextBox32.Text)
.Cells(wohin, 3) = Format(TextBox3.Text)
.Cells(wohin, 4) = Format(TextBox4.Text)
.Cells(wohin, 5) = CDate(TextBox45.Text)
Cells(wohin, 130) = ………(TextBox86.Text) ?
Cells.Select
With Selection
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("F2").Select
End With
ListBox1.SetFocus
End Sub

Anzeige

4
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Benutzer
Anzeige
AW: userform datum
04.02.2011 06:40:29
marcl
Hallo Rolf,
was ist das aktuelle Datum? Heute? Das kann man auch per VBA :
if Cells(wohin, 130) = "" then Cells(wohin, 130) = Date
Gruß
marcl
AW: userform datum
04.02.2011 08:12:14
rolf
hallo marcl
es functioniert leider nicht.
syntaxfehler wird gemeldet.
gruß rolf
AW: userform datum
04.02.2011 09:29:05
marcl
Du beziehst alles auf Sheets("Abstammungen")
ich glaube, es sollte so aussehen:
Private Sub btn_eintragen_Click()
Dim ctl As Control
Dim wohin As Integer
wohin = Sheets("Liste").Range("B8000").End(xlUp).Offset(1, 0).Row
wohin = Me.ListBox1.ListIndex + 1
With Sheets("Abstammungen")
On Error Resume Next
.Cells(wohin, 1) = Format(TextBox1.Text)
.Cells(wohin, 2) = Format(TextBox32.Text)
.Cells(wohin, 3) = Format(TextBox3.Text)
.Cells(wohin, 4) = Format(TextBox4.Text)
.Cells(wohin, 5) = CDate(TextBox45.Text)
'Cells(wohin, 130) = ………(TextBox86.Text) ?
if .Cells(wohin, 130) = "" then .Cells(wohin, 130) = Date
if Sheets("Abstammungen").Cells(wohin, 130) = "" then Sheets("Abstammungen").Cells(wohin, 130) = _
Date
.Cells.Select
With Selection
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("F2").Select
End With
ListBox1.SetFocus
End Sub
Gruß
marcl
Anzeige
AW: userform datum
04.02.2011 10:31:35
rolf
hallo marcl
danke für deine hilfe.
ich habe doch noch eine lösung gefunden.
gruß rolf
;

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Entdecke mehr
Finde genau, was du suchst

Die erweiterte Suchfunktion hilft dir, gezielt die besten Antworten zu finden

Suche nach den besten Antworten
Unsere beliebtesten Threads

Entdecke unsere meistgeklickten Beiträge in der Google Suche

Top 100 Threads jetzt ansehen
Anzeige