18.08.2017, 12:06
Das Wäre der Code:
Code:
Private Sub CommandButton1_Click()
' Eintrag in Tabelle Badge Daten
Dim intErsteLeereZeile As Long
intErsteLeereZeile = Worksheets("BadgeDaten").Cells(Rows.Count, 1).End(xlUp).Row + 1
Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 1).Value = Me.Label9
Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 2).Value = Me.txtNachname.Text
' Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 2).Value = Me.ComboNachname.Text -- falsche deklaration
Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 3).Value = Me.txtVorname.Text
Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 4).Value = Me.ComboAusweis.Text
Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 5).Value = Me.ComboFirma.Text
Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 6).Value = Me.ComboGrund.Text
Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 7).Value = Me.txtAutoNr.Text
Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 8).Value = Me.ComboVerantwortlich.Text
Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 9).Value = Me.txtGültigBis.Text
Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 10).Value = Me.txtBadgeNr.Text
Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 11).Value = Me.ComboAusstellort.Text
' Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 11).Value = Me.txtBadgeNr.Text
Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 15).Value = Me.ComboLogenMA.Text
Worksheets("BadgeDaten").Cells(intErsteLeereZeile, 18).Value = Me.ComboBadgeArt
Dim strFahne As String
Application.ScreenUpdating = False
If Target = Worksheets("BadgeDaten").Range("C3") Then
strFahne = Target
Worksheets("HWBadgeLam").Range("A6").Select
ActiveSheet.Pictures.Delete
ActiveSheet.Pictures.Insert ("C\\ifc1.ifr.intra2.admin.ch\Userhomes\UE1211589\Desktop\Diverses\Fahnen" & strFahne & ".png")
Worksheets("HWBadgeLam").Range("K38").Select
End If
Application.ScreenUpdating = True
' öffnet Tabellenblatt HWBadgeLam und druckt
Worksheets("HWBadgeLam").Visible = True
Worksheets("HWBadgeLam").Activate
ActiveWindow.SmallScroll Down:=-36
Range("A1:m57").Select
Range("A50").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
ActiveWindow.SmallScroll Down:=-15
Worksheets("HWBadgeLam").Visible = False
Unload UserForm10
UserForm10.Show
End Sub