VBA Excel UserForm Daten in Excel ändern

Hallo
Bin am Erstellen eines UserForms welches Daten direkt in ein Excel-File schreibt. Nun komme ich nicht weiter. Stehe vor folgendem Problem:

Wie kann ich den Inhalt der einzelnen Zeilen des Excel-Sheets in den Textboxes anzeigen lassen, diese evtl. korrigieren und den neuen Wert in die ‚alten‘ Felder zurückschreiben. Ohne, dass der neue Wert auf eine neue Zeile geschrieben wird?

Falls es hilft, hier der Code des Forms:
______________________________________________________________________
Private Sub Button1_Click()
z = 2
Do While Cells(z, 1) „“
z = z + 1
Loop
Cells(z, 1) = Me.TextBox1
Cells(z, 2) = Me.TextBox2
Cells(z, 3) = Me.TextBox3
Cells(z, 5) = Me.TextBox4
Cells(z, 6) = Me.ComboBox5
Cells(z, 7) = Me.TextBox6
Cells(z, 8) = Me.ComboBox7
Cells(z, 9) = Me.TextBox8
Cells(z, 10) = Me.ComboBox9
Cells(z, 11) = Me.ComboBox10
Cells(z, 12) = Me.ComboBox11
Cells(z, 13) = Me.TextBox12
Cells(z, 14) = Me.TextBox13
Cells(z, 15) = Me.TextBox14
Cells(z, 16) = Me.TextBox15
Cells(z, 17) = Me.TextBox17
Cells(z, 18) = Me.TextBox17b
Cells(z, 19) = Me.TextBox18
Cells(z, 20) = Me.TextBox18b
Cells(z, 21) = Me.TextBox19
Cells(z, 22) = Me.TextBox19b
Cells(z, 23) = Me.TextBox20
Cells(z, 24) = Me.TextBox20b
Cells(z, 25) = Me.TextBox21
Cells(z, 26) = Me.TextBox21b
Cells(z, 27) = Me.TextBox22
Cells(z, 28) = Me.TextBox22b
Cells(z, 29) = Me.TextBox23
Cells(z, 30) = Me.TextBox23b
Cells(z, 31) = Me.TextBox24
Cells(z, 32) = Me.TextBox24b
Cells(z, 33) = Me.TextBox25
Cells(z, 34) = Me.TextBox25b
Cells(z, 35) = Me.TextBox26
Cells(z, 36) = Me.TextBox26b
Cells(z, 37) = Me.TextBox27
Cells(z, 38) = Me.TextBox27b
Cells(z, 39) = Me.TextBox28
Cells(z, 40) = Me.TextBox28b
Cells(z, 41) = Me.TextBox29
Cells(z, 42) = Me.TextBox29b
Cells(z, 43) = Me.TextBox16
Cells(z, 44) = Me.TextBox30
Cells(z, 45) = Me.TextBox31
Cells(z, 46) = Me.TextBox32
Cells(z, 47) = Me.TextBox33
Cells(z, 48) = Me.TextBox35
Cells(z, 49) = Me.TextBox35a
Cells(z, 50) = Me.TextBox36
Cells(z, 51) = Me.TextBox36a
Cells(z, 52) = Me.TextBox37
Cells(z, 53) = Me.TextBox37a
Cells(z, 54) = Me.TextBox38
Cells(z, 55) = Me.TextBox38a
Cells(z, 56) = Me.TextBox39
Cells(z, 57) = Me.TextBox39a
Cells(z, 58) = Me.TextBox40
Cells(z, 59) = Me.TextBox40a
Cells(z, 60) = Me.TextBox41
Cells(z, 61) = Me.TextBox41a
Cells(z, 62) = Me.TextBox42
Cells(z, 63) = Me.TextBox42a
Cells(z, 64) = Me.TextBox43
Cells(z, 65) = Me.TextBox43a
Cells(z, 66) = Me.TextBox44
Cells(z, 67) = Me.TextBox44a
Cells(z, 68) = Me.TextBox45
Cells(z, 69) = Me.TextBox45a
Cells(z, 70) = Me.TextBox46
Cells(z, 71) = Me.TextBox46a
Cells(z, 72) = Me.TextBox47
Cells(z, 73) = Me.TextBox47a
Cells(z, 74) = Me.TextBox34

TextBox1.Text = „“
TextBox2.Text = „“
TextBox3.Text = „“
TextBox4.Text = „“
ComboBox5.Text = " "
TextBox6.Text = „“
ComboBox7.Text = " "
TextBox8.Text = „“
ComboBox9.Text = " "
ComboBox10.Text = " "
ComboBox11.Text = " "
TextBox12.Text = „“
TextBox13.Text = „“
TextBox14.Text = „“
TextBox15.Text = „“
TextBox17.Text = „“
TextBox17b.Text = „“
TextBox18.Text = „“
TextBox18b.Text = „“
TextBox19.Text = „“
TextBox19b.Text = „“
TextBox20.Text = „“
TextBox20b.Text = „“
TextBox21.Text = „“
TextBox21b.Text = „“
TextBox22.Text = „“
TextBox22b.Text = „“
TextBox23.Text = „“
TextBox23b.Text = „“
TextBox24.Text = „“
TextBox24b.Text = „“
TextBox25.Text = „“
TextBox25b.Text = „“
TextBox26.Text = „“
TextBox26b.Text = „“
TextBox27.Text = „“
TextBox27b.Text = „“
TextBox28.Text = „“
TextBox28b.Text = „“
TextBox29.Text = „“
TextBox29b.Text = „“
TextBox16.Text = „“
TextBox30.Text = „“
TextBox31.Text = „“
TextBox32.Text = „“
TextBox33.Text = „“
TextBox35.Text = „“
TextBox35a.Text = „“
TextBox36.Text = „“
TextBox36a.Text = „“
TextBox37.Text = „“
TextBox37a.Text = „“
TextBox38.Text = „“
TextBox38a.Text = „“
TextBox39.Text = „“
TextBox39a.Text = „“
TextBox40.Text = „“
TextBox40a.Text = „“
TextBox41.Text = „“
TextBox41a.Text = „“
TextBox42.Text = „“
TextBox42a.Text = „“
TextBox43.Text = „“
TextBox43a.Text = „“
TextBox44.Text = „“
TextBox44a.Text = „“
TextBox45.Text = „“
TextBox45a.Text = „“
TextBox46.Text = „“
TextBox46a.Text = „“
TextBox47.Text = „“
TextBox47a.Text = „“
TextBox34.Text = „“

End Sub

Private Sub ButtonVorwaerts_Click()
Dim vZeile As Long

vZeile = ActiveCell.Row

If vZeile 2 Then
Cells(vZeile - 1, ActiveCell.Column).Select
Else
MsgBox „Anfang erreicht!“, vbInformation
End If

End Sub

Private Sub ButtonSpeichern_Click()

fileSaveName = Application.GetSaveAsFilename( _
fileFilter:=„Text Files (*.xls), *.xls“)

If fileSaveName False Then
MsgBox "Daten wurden erfolgt gespeichert ", vbInformation,
End If

End Sub

Private Sub CommandButton6_Click()

With ActiveSheet.PageSetup
.PrintTitleRows = „“
.PrintTitleColumns = „“
End With
ActiveSheet.PageSetup.PrintArea = „“
With ActiveSheet.PageSetup
.LeftHeader = _
„&“„Arial,Fett“"&12Kodierrevision"
.CenterHeader = „“
.RightHeader = „“
.LeftFooter = „&Z&F“
.CenterFooter = „Seite &amp:stuck_out_tongue_winking_eye: von &N“
.RightFooter = „&D - &T“
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 500
.PrintErrors = xlPrintErrorsDisplayed
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

Private Sub CommandButton7_Click()
ActiveWorkbook.Close
End Sub

Private Sub ScrollBar1_Change()
wee = Me.ScrollBar1.Visible
Me.TextBoxFile = we
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Select Case CloseMode
Case 0 'UserForm wurde über das Schliessenkreuz geschlossen
myPrompt = „Wollen Sie vor dem Schliessen des Eingabefensters die Daten speichern?“
Select Case MsgBox(myPrompt, vbQuestion + vbYesNoCancel)
Case vbYes 'Der Anwender will es nicht anders
ButtonSpeichern_Click
Case vbCancel 'Der Anwender will zum Formular zurück
Cancel = True
End Select
Case 1 'UserForm wurde ordentlich geschlossen (Daten bereits gesichert)
Case Else 'Anwendung oder System beendet
End
End Select
End Sub
______________________________________________________________________

Falls mir jemand weiterhelfen kann wäre ich sehr dankbar, da ich mich mit VBA nicht sehr gut auskenne.

Vielen Dank
Michael

For Each
na prima,
bei diesem Code weiss ich gar nicht wo ich anfangen soll mit lesen.

du kannst jedenfalls mit for - each -schleifen schonmal grosse teile des codes sparen.

und um bestimmte Zellwerte in Texboxen einzulesen, dann die Textboxen zu ändern und die geänderten Werte in genau die !Zeile! zurückzuschreiben, musste dir halt nur die Zeilennummer merken, aus der du die quelldaten geholt hast.

Suche am besten weitere Infos zu benutzerdefinierten Datenfeldern oder Arrays, die machen dazu sehr vieles leichter.

Weitere Infos gern direkt: www.xltreffen2006.de.vu
oder per Email.

Mischa Richter