UserForm Werte in bestimmtes Tabellenblatt schreiben dieses aber nicht anzeigen?
Moin,
ich möchte gerne das die Werte aus einer UserForm in das Tabellenblatt Mitglieder übernommen werden, das Tabellenblatt aber nicht angezeigt wird.
Der Button Code sieht so aus:
Private Sub CmdB_Anlegen_Click()
Worksheets("Fahrzeuge").Activate
Dim lastrow, i As Integer
' Letzte Zeile suchen
lastrow = [a65536].End(xlUp).Row + 1
'Zähler für die Fahrzeugnummer
autozaehler = ([a65536].End(xlUp).Row + 1) - 1
' Daten aus der Fahrzeug_Anlegen übertragen
Cells(lastrow, 1) = autozaehler
Cells(lastrow, 2) = Me.TB_Autotyp.Value
Cells(lastrow, 3) = Me.TB_Stundenpreis1.Value
Cells(lastrow, 4) = Me.TB_Stundenpreis2.Value
Cells(lastrow, 5) = Me.TB_Stundenpreis3.Value
Cells(lastrow, 6) = Me.TB_Tagestarif.Value
Cells(lastrow, 7) = Me.TB_Wochenendgutschrift.Value
Cells(lastrow, 8) = Me.TB_Kilometertarif.Value
Cells(lastrow, 9) = Me.TB_Anschaffungspreis.Value
Cells(lastrow, 10) = Me.TB_Anschaffungsdatum.Value
Cells(lastrow, 11) = Me.TB_NächsteHU.Value
Cells(lastrow, 12) = Me.TB_NächsteWartung.Value
' Datenfelder löschen
With Me
.TB_Autonummer.Value = autozaehler + 1
.TB_Autotyp.Value = ""
.TB_Stundenpreis1.Value = ""
.TB_Stundenpreis2.Value = ""
.TB_Stundenpreis3.Value = ""
.TB_Tagestarif.Value = ""
.TB_Wochenendgutschrift.Value = ""
.TB_Kilometertarif.Value = ""
.TB_Anschaffungspreis.Value = ""
.TB_Anschaffungsdatum.Value = ""
.TB_NächsteHU.Value = ""
.TB_NächsteWartung.Value = ""
End With
End Sub
ich möchte gerne das die Werte aus einer UserForm in das Tabellenblatt Mitglieder übernommen werden, das Tabellenblatt aber nicht angezeigt wird.
Der Button Code sieht so aus:
Private Sub CmdB_Anlegen_Click()
Worksheets("Fahrzeuge").Activate
Dim lastrow, i As Integer
' Letzte Zeile suchen
lastrow = [a65536].End(xlUp).Row + 1
'Zähler für die Fahrzeugnummer
autozaehler = ([a65536].End(xlUp).Row + 1) - 1
' Daten aus der Fahrzeug_Anlegen übertragen
Cells(lastrow, 1) = autozaehler
Cells(lastrow, 2) = Me.TB_Autotyp.Value
Cells(lastrow, 3) = Me.TB_Stundenpreis1.Value
Cells(lastrow, 4) = Me.TB_Stundenpreis2.Value
Cells(lastrow, 5) = Me.TB_Stundenpreis3.Value
Cells(lastrow, 6) = Me.TB_Tagestarif.Value
Cells(lastrow, 7) = Me.TB_Wochenendgutschrift.Value
Cells(lastrow, 8) = Me.TB_Kilometertarif.Value
Cells(lastrow, 9) = Me.TB_Anschaffungspreis.Value
Cells(lastrow, 10) = Me.TB_Anschaffungsdatum.Value
Cells(lastrow, 11) = Me.TB_NächsteHU.Value
Cells(lastrow, 12) = Me.TB_NächsteWartung.Value
' Datenfelder löschen
With Me
.TB_Autonummer.Value = autozaehler + 1
.TB_Autotyp.Value = ""
.TB_Stundenpreis1.Value = ""
.TB_Stundenpreis2.Value = ""
.TB_Stundenpreis3.Value = ""
.TB_Tagestarif.Value = ""
.TB_Wochenendgutschrift.Value = ""
.TB_Kilometertarif.Value = ""
.TB_Anschaffungspreis.Value = ""
.TB_Anschaffungsdatum.Value = ""
.TB_NächsteHU.Value = ""
.TB_NächsteWartung.Value = ""
End With
End Sub
Please also mark the comments that contributed to the solution of the article
Content-Key: 75031
Url: https://administrator.de/contentid/75031
Printed on: April 24, 2024 at 02:04 o'clock
2 Comments
Latest comment
Hallo DerParte!
Versuch es so:
Noch eine Anmerkung: Mit
erhält die Variable "lastrow" den Typ "Variant" und nur "i" den Typ "Integer" - eine derartige Schreibweise funktioniert nur in VB (ohne "A" und erst ab .NET).
Grüße
bastla
Versuch es so:
Private Sub CmdB_Anlegen_Click()
With Worksheets("Fahrzeuge")
Dim lastrow As Integer, i As Integer
' Letzte Zeile suchen
lastrow = .[a65536].End(xlUp).Row + 1
'Zähler für die Fahrzeugnummer
autozaehler = lastrow - 1
' Daten aus der Fahrzeug_Anlegen übertragen
.Cells(lastrow, 1) = autozaehler
.Cells(lastrow, 2) = Me.TB_Autotyp.Value
.Cells(lastrow, 3) = Me.TB_Stundenpreis1.Value
.Cells(lastrow, 4) = Me.TB_Stundenpreis2.Value
.Cells(lastrow, 5) = Me.TB_Stundenpreis3.Value
.Cells(lastrow, 6) = Me.TB_Tagestarif.Value
.Cells(lastrow, 7) = Me.TB_Wochenendgutschrift.Value
.Cells(lastrow, 8) = Me.TB_Kilometertarif.Value
.Cells(lastrow, 9) = Me.TB_Anschaffungspreis.Value
.Cells(lastrow, 10) = Me.TB_Anschaffungsdatum.Value
.Cells(lastrow, 11) = Me.TB_NächsteHU.Value
.Cells(lastrow, 12) = Me.TB_NächsteWartung.Value
End With
' Datenfelder löschen
With Me
.TB_Autonummer.Value = autozaehler + 1
.TB_Autotyp.Value = ""
.TB_Stundenpreis1.Value = ""
.TB_Stundenpreis2.Value = ""
.TB_Stundenpreis3.Value = ""
.TB_Tagestarif.Value = ""
.TB_Wochenendgutschrift.Value = ""
.TB_Kilometertarif.Value = ""
.TB_Anschaffungspreis.Value = ""
.TB_Anschaffungsdatum.Value = ""
.TB_NächsteHU.Value = ""
.TB_NächsteWartung.Value = ""
End With
End Sub
Noch eine Anmerkung: Mit
Dim lastrow, i As Integer
Grüße
bastla