Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1656to1660
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Listbox

Listbox
25.11.2018 13:14:14
J.Hass
Hallo
Ich bin es wieder.
In einer Listbox wird mir das Datum vom 01.01.2018 bis 31.12.2018 angezeigt.
Ich möchte gerne das beim Aufrufen der UF die Listbox auf das Heutige Datum springt.
Geht so etwas?
Gruß
Joha

11
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Listbox
25.11.2018 13:18:39
Hajo_Zi
lisbox1=Date

Beiträge von Werner, Luc, robert, J.O.Maximo und folgende lese ich nicht.
Die Beiträge werden auch ignoriert, es erfolgt keine Antwort.
AW: Listbox
25.11.2018 14:03:46
J.Hass
Hallo Hajo
Wo rein ich kann es nicht zuordnen.
Private WithEvents Timer1 As APITimer
Option Explicit
Public ListInd As Long, bol As Boolean
Private Sub UserForm_Activate()
Set Timer1 = New APITimer
Timer1.IntervalMS = 1000
Timer1.Enabled = True
End Sub
Private Sub CommandButton1_Click()
Unload UserForm54
End Sub
Private Sub Uhrzeit_(booStart As Boolean)
Me.Tag = IIf(booStart, "", "1")
If Me.Tag = "1" Then Exit Sub
Application.OnTime Now + TimeSerial(0, 0, 1), "'GetTime """ & Me.Name & """,""" & TextBox33. _
Name & """'"
End Sub
Private Sub CommandButton5_Click()
Dim Suchd As Variant
Dim z As Long
'Inhalt der Textbox in Datumswert umwandeln
Suchd = Date
'Alle Elemente durchsuchen, hier bei mehrspaltigen Inhalten in einer Listbox
For z = 0 To ListBox1.ListCount
If Me.ListBox1.List(z, 0) = Suchd Then
Me.ListBox1.ListIndex = z
Exit For
End If
Next z
End Sub

Private Sub Timer1_Tick()
Dim lngI As Long
On Error Resume Next
For lngI = 0 To 0
With Me.Controls("Label" & lngI)
If CDate(.Caption)  vbRed Then .BackColor = vbRed
Else
If .BackColor  vbGreen Then .BackColor = vbGreen
End If
End With
Next
'    Call Uhrzeit_(True)
TextBox33 = Time$
End Sub

Private Sub CommandButton2_Click()
Dim i As Long
ListInd = ListBox1.ListIndex
bol = True
With Sheets("tabelle1")
.Cells(ListBox1.ListIndex + 2, 1) = TextBox1
.Cells(ListBox1.ListIndex + 2, 2) = TextBox2
.Cells(ListBox1.ListIndex + 2, 3) = TextBox3
.Cells(ListBox1.ListIndex + 2, 4) = TextBox4
.Cells(ListBox1.ListIndex + 2, 5) = TextBox5
.Cells(ListBox1.ListIndex + 2, 6) = TextBox6
.Cells(ListBox1.ListIndex + 2, 7) = TextBox7
.Cells(ListBox1.ListIndex + 2, 8) = TextBox8
.Cells(ListBox1.ListIndex + 2, 9) = TextBox9
.Cells(ListBox1.ListIndex + 2, 10) = TextBox10
.Cells(ListBox1.ListIndex + 2, 11) = TextBox11
.Cells(ListBox1.ListIndex + 2, 12) = TextBox12
.Cells(ListBox1.ListIndex + 2, 13) = TextBox13
.Cells(ListBox1.ListIndex + 2, 14) = TextBox14
.Cells(ListBox1.ListIndex + 2, 15) = TextBox15
.Cells(ListBox1.ListIndex + 2, 16) = TextBox16
.Cells(ListBox1.ListIndex + 2, 17) = TextBox17
.Cells(ListBox1.ListIndex + 2, 18) = TextBox18
.Cells(ListBox1.ListIndex + 2, 19) = TextBox19
.Cells(ListBox1.ListIndex + 2, 20) = TextBox20
.Cells(ListBox1.ListIndex + 2, 21) = TextBox21
.Cells(ListBox1.ListIndex + 2, 22) = TextBox22
.Cells(ListBox1.ListIndex + 2, 23) = TextBox23
.Cells(ListBox1.ListIndex + 2, 24) = TextBox24
.Cells(ListBox1.ListIndex + 2, 25) = TextBox25
.Cells(ListBox1.ListIndex + 2, 26) = TextBox26
.Cells(ListBox1.ListIndex + 2, 27) = TextBox27
.Cells(ListBox1.ListIndex + 2, 28) = TextBox28
.Cells(ListBox1.ListIndex + 2, 29) = TextBox29
.Cells(ListBox1.ListIndex + 2, 30) = TextBox30
End With
For i = 4 To 31
Me.Controls("TextBox" & i) = ""
Next i
ListBox1.Clear
Call t
ListBox1.ListIndex = ListInd
With ListBox1
'TextBox1 = .List(.ListIndex, 0)
'TextBox2 = .List(.ListIndex, 1)
'TextBox3 = .List(.ListIndex, 2)
TextBox4 = .List(.ListIndex, 3)
TextBox5 = .List(.ListIndex, 4)
TextBox6 = .List(.ListIndex, 5)
TextBox7 = .List(.ListIndex, 6)
TextBox8 = .List(.ListIndex, 7)
TextBox9 = .List(.ListIndex, 8)
TextBox10 = .List(.ListIndex, 9)
TextBox11 = .List(.ListIndex, 10)
TextBox12 = .List(.ListIndex, 11)
TextBox13 = .List(.ListIndex, 12)
TextBox14 = .List(.ListIndex, 13)
TextBox15 = .List(.ListIndex, 14)
TextBox16 = .List(.ListIndex, 15)
TextBox17 = .List(.ListIndex, 16)
TextBox18 = .List(.ListIndex, 17)
TextBox19 = .List(.ListIndex, 18)
TextBox20 = .List(.ListIndex, 19)
TextBox21 = .List(.ListIndex, 20)
TextBox22 = .List(.ListIndex, 21)
TextBox23 = .List(.ListIndex, 22)
TextBox24 = .List(.ListIndex, 23)
TextBox25 = .List(.ListIndex, 24)
TextBox26 = .List(.ListIndex, 25)
TextBox27 = .List(.ListIndex, 26)
TextBox28 = .List(.ListIndex, 27)
TextBox29 = .List(.ListIndex, 28)
TextBox30 = .List(.ListIndex, 29)
TextBox31 = .List(.ListIndex, 30)
End With
MsgBox "Daten wurden Eingetragen!"
' umwandeln in datum
'Sub test3()
Range("a2:a367").Select
Dim Zelle As Range
For Each Zelle In Selection
If Zelle  "" Then Zelle = CDate(Zelle)
Next
'End
Unload UserForm54
UserForm54.Show
End Sub
Private Sub CommandButton4_Click()
Dim i As Long
If ListBox1.ListIndex = 0 Then Exit Sub
ListBox1.ListIndex = ListBox1.ListIndex - 1
End Sub

Private Sub CommandButton3_Click()
Dim i As Long
If ListBox1.ListIndex = ListBox1.ListCount - 1 Then Exit Sub
ListBox1.ListIndex = ListBox1.ListIndex + 1
End Sub

Private Sub listbox1_Change()
Dim i As Long
If bol Then bol = False: Exit Sub
For i = 1 To 31
Me.Controls("TextBox" & i) = ""
Next i
With ListBox1
TextBox1 = .List(.ListIndex, 0)
TextBox2 = .List(.ListIndex, 1)
TextBox3 = .List(.ListIndex, 2)
TextBox4 = .List(.ListIndex, 3)
TextBox5 = .List(.ListIndex, 4)
TextBox6 = .List(.ListIndex, 5)
TextBox7 = .List(.ListIndex, 6)
TextBox8 = .List(.ListIndex, 7)
TextBox9 = .List(.ListIndex, 8)
TextBox10 = .List(.ListIndex, 9)
TextBox11 = .List(.ListIndex, 10)
TextBox12 = .List(.ListIndex, 11)
TextBox13 = .List(.ListIndex, 12)
TextBox14 = .List(.ListIndex, 13)
TextBox15 = .List(.ListIndex, 14)
TextBox16 = .List(.ListIndex, 15)
TextBox17 = .List(.ListIndex, 16)
TextBox18 = .List(.ListIndex, 17)
TextBox19 = .List(.ListIndex, 18)
TextBox20 = .List(.ListIndex, 19)
TextBox21 = .List(.ListIndex, 20)
TextBox22 = .List(.ListIndex, 21)
TextBox23 = .List(.ListIndex, 22)
TextBox24 = .List(.ListIndex, 23)
TextBox25 = .List(.ListIndex, 24)
TextBox26 = .List(.ListIndex, 25)
TextBox27 = .List(.ListIndex, 26)
TextBox28 = .List(.ListIndex, 27)
TextBox29 = .List(.ListIndex, 28)
TextBox30 = .List(.ListIndex, 29)
TextBox31 = .List(.ListIndex, 30)
End With
End Sub
Private Sub UserForm_Initialize()
Dim i As Long, DatArr As Variant
With Sheets("tabelle1")
If .Cells(Rows.Count, 1).End(xlUp).Row > 1 Then
DatArr = .Range("A2:ct" & .Cells(Rows.Count, 1).End(xlUp).Row)
ListBox1.List = DatArr
ListBox1.ListIndex = 0
End If
End With
With ListBox1
TextBox1 = .List(.ListIndex, 0)
TextBox2 = .List(.ListIndex, 1)
TextBox3 = .List(.ListIndex, 2)
TextBox4 = .List(.ListIndex, 3)
TextBox5 = .List(.ListIndex, 4)
TextBox6 = .List(.ListIndex, 5)
TextBox7 = .List(.ListIndex, 6)
TextBox8 = .List(.ListIndex, 7)
TextBox9 = .List(.ListIndex, 8)
TextBox10 = .List(.ListIndex, 9)
TextBox11 = .List(.ListIndex, 10)
TextBox12 = .List(.ListIndex, 11)
TextBox13 = .List(.ListIndex, 12)
TextBox14 = .List(.ListIndex, 13)
TextBox15 = .List(.ListIndex, 14)
TextBox16 = .List(.ListIndex, 15)
TextBox17 = .List(.ListIndex, 16)
TextBox18 = .List(.ListIndex, 17)
TextBox19 = .List(.ListIndex, 18)
TextBox20 = .List(.ListIndex, 19)
TextBox21 = .List(.ListIndex, 20)
TextBox22 = .List(.ListIndex, 21)
TextBox23 = .List(.ListIndex, 22)
TextBox24 = .List(.ListIndex, 23)
TextBox25 = .List(.ListIndex, 24)
TextBox26 = .List(.ListIndex, 25)
TextBox27 = .List(.ListIndex, 26)
TextBox28 = .List(.ListIndex, 27)
TextBox29 = .List(.ListIndex, 28)
TextBox30 = .List(.ListIndex, 29)
TextBox31 = .List(.ListIndex, 30)
End With
End Sub

Sub t()
Dim DatArr As Variant
With Sheets("tabelle1")
If .Cells(Rows.Count, 1).End(xlUp).Row > 1 Then
DatArr = .Range("A2:ct" & .Cells(Rows.Count, 1).End(xlUp).Row)
ListBox1.List = DatArr
ListBox1.ListIndex = 0
End If
End With
End Sub
Gruß
Joha
Anzeige
AW: Listbox
25.11.2018 14:09:17
Hajo_Zi
bei
Private Sub UserForm_Activate()
da die Liste in Eigenschaften zugewiesen wurde.
Gruß Hajo
AW: Listbox
25.11.2018 19:28:26
Hass
Hallo Hajo
es geht nicht.
Beim Starten der UF soll in der ListBox auf das Datum(Heute)gesprungen werden.
Gruß
Joha
AW: Listbox
25.11.2018 19:29:49
Hajo_Zi
frage jemand der neben Dir sitzt der sieht die Datei.
Ich sehe Sie nicht.
Gruß Hajo
AW: Listbox
25.11.2018 19:47:34
Hass
Hallo Hajo,
habe ich keinen.
Dank....Danke
Gruß Joha
AW: Listbox
25.11.2018 23:52:41
Mullit
Hallo,
versuch's so:
Option Explicit

Private Sub UserForm_Activate()
Dim lngIndex As Long
With ListBox1
    For lngIndex = 0 To .ListCount - 1
        If .List(pvargIndex:=lngIndex) = Date Then _
           .Selected(pvargIndex:=lngIndex) = True: Exit For
    Next
End With
End Sub


VBA/HTML - CodeConverter für Office-Foren
AddIn für Excel/Word 2000-2010 - komplett in VBA geschrieben von Lukas Mosimann
Projektbetreuung durch mumpel



Code erstellt und getestet in Office 14

Gruß, Mullit
Anzeige
AW: Listbox
26.11.2018 10:10:56
J.Hass
Hallo Mullit
Das Läuft und Läuft und Läuft.
Danke....Danke
Gruß
Joha
AW: Listbox
26.11.2018 11:52:01
Werner
Hallo,
das geht doch auch einfacher:
Private Sub UserForm_Initialize()
Dim DatArr As Variant
With Sheets("Tabelle1")
If .Cells(Rows.Count, 1).End(xlUp).Row > 1 Then
DatArr = .Range("A2:AC" & .Cells(Rows.Count, 1).End(xlUp).Row)
ListBox1.List = DatArr
ListBox1.ListIndex = Left(Date, 2) - 1
End If
End With
End Sub

Und dann noch den Großkotz raushängen. o.w.T.
26.11.2018 11:53:16
Werner
Was für ein Schwachsinn. o.w.T.
26.11.2018 11:52:37
Werner

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige