Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1244to1248
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

Daten Eingabe

Daten Eingabe
Ralf
Hallo Forum
Gebe über Userform1 Daten ins Tabellenblatt ein . Meine Frage ist kann man den Code kürzer schreiben.
Public Sub DatenEingabe()
With ActiveSheet
For lngSpalte = 2 To 65536
If .Cells(lngSpalte, 20) = Empty Then
.Cells(lngSpalte, 20) = UserForm1.ComboBox2.Text
.Cells(lngSpalte, 21) = UserForm1.TextBox2.Text
.Cells(lngSpalte, 22) = UserForm1.TextBox3.Text
.Cells(lngSpalte, 23) = UserForm1.TextBox4.Text
.Cells(lngSpalte, 24) = UserForm1.TextBox5.Text
.Cells(lngSpalte, 25) = UserForm1.TextBox6.Text
.Cells(lngSpalte, 26) = UserForm1.TextBox7.Text
.Cells(lngSpalte, 27) = UserForm1.TextBox8.Text
.Cells(lngSpalte, 28) = UserForm1.TextBox9.Text
.Cells(lngSpalte, 29) = UserForm1.TextBox10.Text
.Cells(lngSpalte, 30) = UserForm1.TextBox11.Text
.Cells(lngSpalte, 31) = UserForm1.TextBox12.Text
.Cells(lngSpalte, 32) = UserForm1.TextBox13.Text
.Cells(lngSpalte, 33) = UserForm1.TextBox14.Text
.Cells(lngSpalte, 34) = UserForm1.TextBox15.Text
.Cells(lngSpalte, 35) = UserForm1.TextBox16.Text
.Cells(lngSpalte, 36) = UserForm1.TextBox17.Text
Exit For
End If
Next
End With
End Sub

mfg Ralf

3
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Benutzer
Anzeige
AW: Daten Eingabe
12.01.2012 20:53:32
Martin
Hallo Ralf,
ungetestet, aber hoffentlich fehlerfrei:
Public Sub DatenEingabe()
Dim lngSpalte As Long, intTbx As Integer
With ActiveSheet
For lngSpalte = 2 To 65536
If .Cells(lngSpalte, 20) = Empty Then
.Cells(lngSpalte, 20) = UserForm1.ComboBox2.Text
For intTbx = 2 To 17
.Cells(lngSpalte, intTbx + 19) = UserForm1.Controls("TextBox" & intTbx). _
Text
Next
Exit For
End If
Next
End With
End Sub
Viele Grüße
Martin
AW: Daten Eingabe
12.01.2012 20:54:22
Josef

Hallo Ralf,
ungetestet!
Public Sub DatenEingabe()
  Dim lngNextRow As Long, lngIndex As Long
  
  With ActiveSheet
    lngNextRow = Application.Max(2, .Cells(.Rows.Count, 20).End(xlUp).Row + 1)
    .Cells(lngNextRow, 20) = UserForm1.ComboBox2.Text
    For lngIndex = 21 To 36
      .Cells(lngNextRow, lngIndex) = UserForm1.Controls("TextBox" & lngIndex - 19).Text
    Next
  End With
  
End Sub



« Gruß Sepp »

Anzeige
AW: Daten Eingabe
12.01.2012 21:13:12
Ralf
Hallo Josef und Martin und Forum
Läuft hervorragend . Vielen dank für die schnelle Hilfe
Gruss ralf

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige