AW: Excel schmiert ab bei UF befüllen
21.11.2007 23:26:00
Renee
Hi Martin,
Der folgende Code macht das Gleiche, wie dein 1000zeiliger... ;-)
Woran es liegt, dass Excel stirbt weiss ich nicht. Vielleicht an den hunderten von Controls in der UF ?
Private Sub CommandButton3_Click()
Dim lRow As Long
Dim lCol As Long
Application.ScreenUpdating = False
Sheets("HB-Posten").Unprotect
For lRow = 5 To 16
For lCol = 3 To 26
Sheets("HB-Posten").Cells(lRow, lCol) = _
UserForm6.Controls("TextBox" & (lRow * 24 + lCol - 122))
Next lCol
Next lRow
Sheets("HB-Posten").Range("B50") = OptionButton1.Value
Sheets("HB-Posten").Range("B51") = OptionButton2.Value
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub CommandButton1_Click()
Dim lRow As Long
Dim lCol As Long
Dim Antwort As Integer
Antwort = MsgBox("Wenn Sie die Standard Posten aufrufen gehen Ihre Veränderungen verloren. Mö _
chten Sie fortfahren ? ", vbYesNo + vbQuestion, "Dienstplanorganizer 2008")
If Antwort = vbNo Then
Exit Sub
End If
If OptionButton2.Value Then
For lRow = 36 To 47
For lCol = 3 To 26
UserForm6.Controls("TextBox" & (lRow * 24 + lCol - 866)) = _
Sheets("HB-Posten").Cells(lRow, lCol)
Next lCol
Next lRow
End If
If OptionButton1.Value = True Then
For lRow = 21 To 32
For lCol = 3 To 26
UserForm6.Controls("TextBox" & (lRow * 24 + lCol - 506)) = _
Sheets("HB-Posten").Cells(lRow, lCol)
Next lCol
Next lRow
End If
End Sub
Private Sub CommandButton4_Click()
Dim lRow As Long
Dim lCol As Long
Label193.Visible = True
For lRow = 5 To 16
For lCol = 3 To 26
UserForm6.Controls("TextBox" & (lRow * 24 + lCol - 122)) = _
Sheets("HB-Posten").Cells(lRow, lCol)
Next lCol
Next lRow
OptionButton1.Value = Sheets("HB-Posten").Range("B50")
OptionButton2.Value = Sheets("HB-Posten").Range("B51")
Label193.Visible = False
End Sub
Private Sub UserForm_Initialize()
OptionButton1.Value = True
If Year(Date) 2008 Then
UserForm6.MultiPage1.Value = 0
Else
UserForm6.MultiPage1.Value = Month(Date) - 1
End If
End Sub
Sub AreYouSure()
Dim Antwort As Integer
Antwort = MsgBox("Wenn Sie die Standard Posten aufrufen gehen Ihre Veränderungen verloren. Mö _
chten Sie fortfahren ? ", vbYesNo + vbQuestion, "Dienstplanorganizer 8")
If Antwort = vbYes Then
CommandButton1_Click
End If
If Antwort = vbNo Then
Exit Sub
End If
End Sub
GreetZ Renee