Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ListBox - Script funzt nich

Empfohlene Antworten

Veröffentlicht

Moinsen!!

Ich habe folgendes Script und das will nicht so, wie ich das will:


Private Sub UserForm_Initialize()

ListBox1.ColumnCount = 2

For i = 3 To 50

    If Cells(i, 1) <> "" Then

        ListBox1.List(i - 3, 0) = Cells(i, 1)

        ListBox1.List(i - 3, 0) = Cells(i, 2)

    Else

        Exit For

    End If

Next i

End Sub

Im Klartext:

Ich habe eine UserForm mit einem ListBox-Steuerelement.

Und in diese ListBox sollen in 2 Spalten Einträge aus 'ner Excel-Tabelle übernommen werden.

Bei obigem Code kommt aber immer der Fehler "Laufzeitfehler 381: Eigenschaft List konnte nicht gesetzt werden. Index des Eigenschaftsfelds ungültig."

Hilfeeee!!!

Ich glaub du gehst die Sache etwas falsch an.

Wenn du etwas in eine Listbox übernehmen möchtest, dann geht das mit

Listbox1.AddItem (String, Index)

Hoffe das hilft dir etwas weiter.

<FONT COLOR="#a62a2a" SIZE="1">[ 29. August 2001 08:27: Beitrag 1 mal editiert, zuletzt von Spike ]</font>

...hab's schon selbst hinbekommen.

Hat komischerweise dann doch so geklappt, wie ich's oben schon mal versucht habe...

Dass das mit AddItem geht, wusste ich auch, nur das Problem war, dass ich mehrere Spalten in die ListBox haben wollte.

Hab' das jetzt mit 'ner Matrix gelöst:

  

Dim KStellen(50, 2)

ListBox1.ColumnCount = 2

For i = 3 To 50

    If Cells(i, 1) <> "" Then

        KStellen(i - 3, 0) = Cells(i, 1)

        KStellen(i - 3, 1) = Cells(i, 2)

    Else

        Exit For

    End If

Next i

ListBox1.List = KStellen

So klappts...

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.