AW: Arbeitsmappe anlegen laut Zelleninhalt
29.05.2004 15:20:37
Ossi
Hallo Beni,
hier der Code den ich für die Suchfunktion erstellt habe.
Gruß
Ossi
Private Sub CommandButton4_Click()
Sheets("S_Stammdaten").Visible = True
Set Frm2 = UserForm1
With Frm2
Sheets("S_Stammdaten").Select
Range("A:A").Select
On Error GoTo Fehler
Selection.Find(what:=.ComboBox1.Value, _
after:=ActiveCell, _
LookIn:=xlFormulas, lookat:=xlWhole, _
searchorder:=xlByRows, searchdirection:=xlNext, _
MatchCase:=False).Activate
.TextBox37.Value = ActiveCell.Offset(0, 1).Value 'Name
.TextBox38.Value = ActiveCell.Offset(0, 2).Value 'Vorname
.TextBox39.Value = ActiveCell.Offset(0, 3).Value 'Straße
.TextBox40.Value = ActiveCell.Offset(0, 4).Value 'PLZ
.TextBox41.Value = ActiveCell.Offset(0, 5).Value 'Ort
If ActiveCell.Offset(0, 6) = "ja" Then CheckBox3.Value = True 'Wenn Ankestellter "ja" dann Checkbox3 aktivieren
If ActiveCell.Offset(0, 6) = "nein" Then CheckBox3.Value = False 'Wenn Ankestellter "ja" dann Checkbox3 deaktivieren
.TextBox42.Value = ActiveCell.Offset(0, 7).Value 'Urlaubstage
If ActiveCell.Offset(0, 8) = "ja" Then CheckBox4.Value = True 'Wenn Dienst "ja" dann Checkbox4 aktivieren
If ActiveCell.Offset(0, 8) = "nein" Then CheckBox4.Value = False 'Wenn Dienst "ja" dann Checkbox4 deaktivieren
.TextBox43.Value = ActiveCell.Offset(0, 10).Value 'KFZ-Kennzeichen
.TextBox44.Value = ActiveCell.Offset(0, 9).Value 'Kilometer
.TextBox45.Value = ActiveCell.Offset(0, 12).Value 'Text für Bereitschaft
.TextBox46.Value = ActiveCell.Offset(0, 11).Value 'Kostenstelle
.TextBox47.Value = ActiveCell.Offset(0, 13).Value 'Arbeitsstunden Montag
.TextBox47 = Format(TextBox47, "h:mm")
.TextBox48.Value = ActiveCell.Offset(0, 14).Value 'Arbeitsstunden Dienstag
.TextBox48 = Format(TextBox48, "h:mm")
.TextBox49.Value = ActiveCell.Offset(0, 15).Value 'Arbeitsstunden Mittwoch
.TextBox49 = Format(TextBox49, "h:mm")
.TextBox50.Value = ActiveCell.Offset(0, 16).Value 'Arbeitsstunden Donnerstag
.TextBox50 = Format(TextBox50, "h:mm")
.TextBox51.Value = ActiveCell.Offset(0, 17).Value 'Arbeitsstunden Freitag
.TextBox51 = Format(TextBox51, "h:mm")
.TextBox52.Value = ActiveCell.Offset(0, 18).Value 'Arbeitsstunden Samstag
.TextBox52 = Format(TextBox52, "h:mm")
.TextBox53.Value = ActiveCell.Offset(0, 19).Value 'Arbeitsstunden Sonntag
.TextBox53 = Format(TextBox53, "h:mm")
.TextBox54.Value = ActiveCell.Offset(0, 20).Value 'Frühstückspause Montag
.TextBox54 = Format(TextBox54, "h:mm")
.TextBox55.Value = ActiveCell.Offset(0, 21).Value 'Frühstückspause Dienstag
.TextBox55 = Format(TextBox55, "h:mm")
.TextBox56.Value = ActiveCell.Offset(0, 22).Value 'Frühstückspause Mittwoch
.TextBox56 = Format(TextBox56, "h:mm")
.TextBox57.Value = ActiveCell.Offset(0, 23).Value 'Frühstückspause Donnerstag
.TextBox57 = Format(TextBox57, "h:mm")
.TextBox58.Value = ActiveCell.Offset(0, 24).Value 'Frühstückspause Freitag
.TextBox58 = Format(TextBox58, "h:mm")
.TextBox59.Value = ActiveCell.Offset(0, 25).Value 'Frühstückspause Samstag
.TextBox59 = Format(TextBox59, "h:mm")
.TextBox60.Value = ActiveCell.Offset(0, 26).Value 'Frühstückspause Sonntag
.TextBox60 = Format(TextBox60, "h:mm")
.TextBox61.Value = ActiveCell.Offset(0, 27).Value 'Mittagspause Montag
.TextBox61 = Format(TextBox61, "h:mm")
.TextBox62.Value = ActiveCell.Offset(0, 28).Value 'Mittagspause Dienstag
.TextBox62 = Format(TextBox62, "h:mm")
.TextBox63.Value = ActiveCell.Offset(0, 29).Value 'Mittagspause Mittwoch
.TextBox63 = Format(TextBox63, "h:mm")
.TextBox64.Value = ActiveCell.Offset(0, 30).Value 'Mittagspause Donnerstag
.TextBox64 = Format(TextBox64, "h:mm")
.TextBox65.Value = ActiveCell.Offset(0, 31).Value 'Mittagspause Freitag
.TextBox65 = Format(TextBox65, "h:mm")
.TextBox66.Value = ActiveCell.Offset(0, 32).Value 'Mittagspause Samstag
.TextBox66 = Format(TextBox66, "h:mm")
.TextBox67.Value = ActiveCell.Offset(0, 33).Value 'Mittagspause Sonntag
.TextBox67 = Format(TextBox67, "h:mm")
.TextBox68.Value = ActiveCell.Offset(0, 34).Value 'Uhrzeiten für Pause: Frühstück_von
.TextBox68 = Format(TextBox68, "h:mm")
.TextBox69.Value = ActiveCell.Offset(0, 35).Value 'Uhrzeiten für Pause: Frühstück_bis
.TextBox69 = Format(TextBox69, "h:mm")
.TextBox70.Value = ActiveCell.Offset(0, 36).Value 'Uhrzeiten für Pause: Mittag_von
.TextBox70 = Format(TextBox70, "h:mm")
.TextBox71.Value = ActiveCell.Offset(0, 37).Value 'Uhrzeiten für Pause: Mittag_bis
.TextBox71 = Format(TextBox71, "h:mm")
Exit Sub
Fehler:
MsgBox "Die Personalnummer : " & _
ComboBox1.Value & " ist nicht vorhanden!"
End With
End Sub