wir haben in der Arbeit eine User Form und jetzt möchte ich gerne das Excel die Daten errechnet.
Option Explicit
Dim AC As Range, sp As Integer, Datum As Date
Dim ZielWb As Object, ZTb As String
Private Sub TextBox100_AfterUpdate()
On Error GoTo 0
Datum = CDate(UserForm2.TextBox100)
ZTb = CStr(Right(UserForm2.TextBox100, 4))
If InStr(ZTb, ".") Then
MsgBox "'" & ZTb & "' - Das Jahr stimmt nicht - kann nicht befüllen!!": Exit Sub
End If
On Error Resume Next 'Abbruch bei Fehler!!
'Zielmappe setzen - vier Stellen Jahresdatum
Set ZielWb = Workbooks(Ziel_Mappe).Worksheets(ZTb)
If Err > 0 Then MsgBox ZTb & " - Diese Jahres Tabelle exisitert nicht !!": Exit Sub
On Error GoTo Fehler 'Abbruch bei Fehler!!
'Suche nach Datum von B1-N1 (Find klappt nicht!!)
For Each AC In ZielWb.Range("B1:ND1")
If AC.Value = Datum Then sp = AC.Column: Exit For
Next AC
If sp = Empty Then MsgBox Datum & " kann Datum nicht finden!": Exit Sub
With UserForm2
.TextBox1.Value = ZielWb.Cells(4, sp)
.TextBox2.Value = ZielWb.Cells(5, sp)
.TextBox3.Value = ZielWb.Cells(6, sp)
.TextBox4.Value = ZielWb.Cells(7, sp)
.TextBox9.Value = ZielWb.Cells(9, sp)
.TextBox5.Value = ZielWb.Cells(10, sp)
.TextBox6.Value = ZielWb.Cells(11, sp)
' .TextBox7.Value = ZielWb.Cells(12, sp)
'.TextBox8.Value = ZielWb.Cells(13, sp)
.TextBox101.Value = ZielWb.Cells(14, sp)
.TextBox102.Value = ZielWb.Cells(15, sp)
.TextBox103.Value = ZielWb.Cells(16, sp)
.TextBox104.Value = ZielWb.Cells(17, sp)
.TextBox107.Value = ZielWb.Cells(18, sp)
.TextBox10.Value = ZielWb.Cells(20, sp)
.TextBox11.Value = ZielWb.Cells(21, sp)
.TextBox12.Value = ZielWb.Cells(19, sp)
.TextBox13.Value = ZielWb.Cells(26, sp)
'.TextBox18.Value = ZielWb.Cells(19, sp)
'.TextBox14.Value = ZielWb.Cells(20, sp)
'.TextBox15.Value = ZielWb.Cells(21, sp)
'.TextBox16.Value = ZielWb.Cells(22, sp)
'.TextBox17.Value = ZielWb.Cells(23, sp)
.TextBox19.Value = ZielWb.Cells(24, sp)
.TextBox20.Value = ZielWb.Cells(25, sp)
'.TextBox21.Value = ZielWb.Cells(26, sp)
.TextBox30.Value = ZielWb.Cells(34, sp) 'Spätschicht
.TextBox31.Value = ZielWb.Cells(35, sp)
.TextBox32.Value = ZielWb.Cells(36, sp)
.TextBox33.Value = ZielWb.Cells(37, sp)
.TextBox38.Value = ZielWb.Cells(38, sp)
.TextBox34.Value = ZielWb.Cells(39, sp)
.TextBox35.Value = ZielWb.Cells(40, sp)
.TextBox36.Value = ZielWb.Cells(41, sp)
.TextBox37.Value = ZielWb.Cells(42, sp)
.TextBox39.Value = ZielWb.Cells(43, sp).Text
.TextBox40.Value = ZielWb.Cells(44, sp).Text
'.TextBox41.Value = ZielWb.Cells(45, sp)
.TextBox42.Value = ZielWb.Cells(45, sp)
.TextBox47.Value = ZielWb.Cells(50, sp)
' .TextBox43.Value = ZielWb.Cells(48, sp)
'.TextBox44.Value = ZielWb.Cells(49, sp)
'.TextBox45.Value = ZielWb.Cells(50, sp)
.TextBox46.Value = ZielWb.Cells(51, sp)
.TextBox48.Value = ZielWb.Cells(52, sp)
.TextBox49.Value = ZielWb.Cells(53, sp)
.TextBox60.Value = ZielWb.Cells(76, sp) ' Zusammenfassung
' .TextBox61.Value = ZielWb.Cells(77, sp)
' .TextBox6.Value = ZielWb.Cells(27, sp) 'TextBox6 = Daten25
End With
Exit Sub
Fehler: MsgBox Datum & " - unerwarteter Fehler beim TextBox befüllen!!"
End Sub
in der Zeile 76 sehe ich wieviel Mitarbeiter ich habe.In der Zeile 2 werden die Kranken angezeigt.
Kann ich eine neue "Txt_ProzentKank" Anzeigen lassen wieviel % das ausmacht ohne das ich eine Zeile im Tabellenblatt brauche ?
Würde das auch einen Durchschnittswert "Txt_Jahresdurchschnitt_inProzent" geben. Das heißt von Januar bis heute (
Zeile 2 )
Ich hoffe ihr könnt mir dabei helfen.
Dankeschööööön :-)