Focus klappt nicht
walterMB
ich habe folgendes Makro für meine Textbox3; wenn ich die Zahl eingebe funktioniert es auch das der Focus wieder auf der Textbox3 ist.
Gebe ich jetzt erneut eine Zahl ein und die Textbox ist noch Schwarz bzw. weiterhin Visible, dann geht der Focus in die nächste Box bzw. hier auf das Command Button.
Die Aktivierungsfolge habe ich ebenfalls eingestellt.
Makro:
'
Private Sub TextBox3_Change()
Private Sub TextBox3_AfterUpdate()
If TextBox3.Value = "" Then
TextBox3.Value = "0.00"
End If
ThisWorkbook.Worksheets("Lager").Range("K19") = CDbl(TextBox3)
TextBox3 = Format(Worksheets("Lager").Range("K19").Value, ("0.00"))
If Worksheets("Lagert").Range("K19") > "0" Then
Worksheets("Lager").Range("K21") = "0"
TextBox4 = Format(Worksheets("Lager").Range("I32").Value, ("#,##0.00"))
TextBox4.Enabled = False
TextBox4.BackColor = Me.BackColor
TextBox3.SetFocus
With TextBox3
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
End If
If ThisWorkbook.Worksheets("Lager").Range("K19") = 0 Then
TextBox4 = Format(Worksheets("Lager").Range("K21").Value, ("#,##0.00"))
TextBox4.Enabled = True
TextBox4.BackColor = vbWhite
TextBox3.SetFocus
With TextBox3
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
End If
End Sub
Was habe ich verkehrt gemacht ?
Walter