Hallo
Ich habe sehr viele Textboxen in einem Formular und in diesen sollen Werte aus einem Excel Sheet.
Nun ist es bestimmt relativ unelegant und auch vom Rechenaufwand hoch, wenn ich jeden Befehl ausschreibe.
Kann man sowas auch mit For-Schleifen lösen? Müsste ja vermutlich eine doppelt sein, aber da komm ich irgendwie nicht weiter
Hier ein Ausschnitt aus dem derzeitigen Problem:
(Eigentlich gibt nicht wie hier 4 Spalten sondern 10 und nicht nur 5 Zeilen sondern viel mehr)
Ich habe sehr viele Textboxen in einem Formular und in diesen sollen Werte aus einem Excel Sheet.
Nun ist es bestimmt relativ unelegant und auch vom Rechenaufwand hoch, wenn ich jeden Befehl ausschreibe.
Kann man sowas auch mit For-Schleifen lösen? Müsste ja vermutlich eine doppelt sein, aber da komm ich irgendwie nicht weiter
Hier ein Ausschnitt aus dem derzeitigen Problem:
(Eigentlich gibt nicht wie hier 4 Spalten sondern 10 und nicht nur 5 Zeilen sondern viel mehr)
Visual Basic-Quellcode
- Private Sub UserForm_Initialize()
- Dim wstTab As Worksheet
- Set wstTab = Tabelle6
- Me.txtBreite1 = wstTab.Cells(5, 1).Value
- Me.txtLaenge1 = wstTab.Cells(5, 2).Value
- Me.txtStaerke1 = wstTab.Cells(5, 3).Value
- Me.txtHoehe1 = wstTab.Cells(5, 4).Value
- Me.txtBreite2 = wstTab.Cells(6, 1).Value
- Me.txtLaenge2 = wstTab.Cells(6, 2).Value
- Me.txtStaerke2 = wstTab.Cells(6, 3).Value
- Me.txtHoehe2 = wstTab.Cells(6, 4).Value
- Me.txtBreite3 = wstTab.Cells(7, 1).Value
- Me.txtLaenge3 = wstTab.Cells(7, 2).Value
- Me.txtStaerke3 = wstTab.Cells(7, 3).Value
- Me.txtHoehe3 = wstTab.Cells(7, 4).Value
- Me.txtBreite4 = wstTab.Cells(8, 1).Value
- Me.txtLaenge4 = wstTab.Cells(8, 2).Value
- Me.txtStaerke4 = wstTab.Cells(8, 3).Value
- Me.txtHoehe4 = wstTab.Cells(8, 4).Value
- Me.txtBreite5 = wstTab.Cells(9, 1).Value
- Me.txtLaenge5 = wstTab.Cells(9, 2).Value
- Me.txtStaerke5 = wstTab.Cells(9, 3).Value
- Me.txtHoehe5 = wstTab.Cells(9, 4).Value
- End Sub