Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
876to880
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
876to880
876to880
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Probleme mit Userform

Probleme mit Userform
19.06.2007 15:01:03
Peter
Hallo alle zusammen,
ich habe zwei Probleme mit meiner Userform:
1.
in meiner Userform gibt es mehrere Textfelder, Comboboxen und die Commandbutton "OK" und "Abbrechen".
Das Commandbutton "OK" soll Enabled = True werden und der Focus soll auf "OK" stehen, wenn in allen Textfeldern und Comboboxen die Enabled = True sind etwas eingetragen ist.
Der Code von "

Private Sub OK_True()" sollte das steuern, funktioniert aber nicht.
2.
Nachdem ich die Eintragungen mit "OK" bestetigt habe bleibt der Code im "

Private Sub cmdOK_Click()" an der Stelle "If cboArt.Text = "-" Or "-a" Then" hängen.
Warum?
Kann mir jemand helfen?
Danke im Voraus
Grüße aus Berlin
Der Code der Userform:
Option Explicit


Private Sub OK_True()
cmdOK.Enabled = True
Dim Ob As MSForms.Control
For Each Ob In Controls
If TypeOf Ob Is MSForms.TextBox Then If Ob.Value = "" Then cmdOK.Enabled = False
If TypeOf Ob Is MSForms.ComboBox Then If Ob.Value = "" Then cmdOK.Enabled = False
Next Ob
If cmdOK.Enabled = True Then cmdOK.SetFocus
End Sub



Private Sub cboArt_AfterUpdate()
OK_True
End Sub



Private Sub cboArt_Change()
Select Case cboArt.Text
Case "+/-"
cboGesellschaft_Konto_intern.Enabled = True
cboGesellschaft_Konto_intern.BackColor = &H80000005
Me.cboGesellschaft_Konto_intern = "DA/Allgemeines Lewa"
Case Else
cboGesellschaft_Konto_intern.Text = ""
cboGesellschaft_Konto_intern.Enabled = False
cboGesellschaft_Konto_intern.BackColor = 14737632
End Select
End Sub



Private Sub cboGesellschaft_Konto_AfterUpdate()
OK_True
End Sub



Private Sub cboGesellschaft_Konto_intern_AfterUpdate()
OK_True
End Sub



Private Sub cboGesellschaft_Konto_Change()
Select Case cboGesellschaft_Konto.Text
Case "AS/Allgemeines Lewa", "AW/Allgemeines Lewa", _
"AW/Allgemeines Euro", "AW/Treuhand Lewa", "AW/Treuhand Euro"
txtBetrag_MwSt.Text = ""
txtBetrag_MwSt.Enabled = False
txtBetrag_MwSt.BackColor = 14737632
Case Else
txtBetrag_MwSt.Enabled = True
txtBetrag_MwSt.BackColor = &H80000005
End Select
End Sub



Private Sub cmdAbbrechen_Click()
Unload Me
End Sub



Private Sub cmdOK_Click()
Dim cell As Range
Dim a As Long
Dim lbMsg As Byte
SpeedUp (True)
ActiveSheet.Unprotect Password:="Peter"
If Not IsDate(txtDatum.Text) = True Then
lbMsg = MsgBox("Geben Sie ein gültiges Datum ein", vbExclamation, "falsche Eingabe") _
txtDatum.Text = ""
txtDatum.SetFocus
cmdOK.Enabled = False
Exit Sub
End If
If Not IsDate(txtfaellig_zum.Text) = True Then
lbMsg = MsgBox("Geben Sie ein gültiges Datum ein", vbExclamation, "falsche Eingabe") _
txtfaellig_zum.Text = ""
txtfaellig_zum.SetFocus
cmdOK.Enabled = False
Exit Sub
End If
If cboArt.Text = "-" Or "-a" Then
If Val(txtBetrag_Gesellschaft_Konto.Text) > 0 Then
lbMsg = MsgBox("Geben Sie einen negativen Wert ein", vbExclamation, " _
falsche Eingabe")
txtBetrag_Gesellschaft_Konto.Text = ""
txtBetrag_Gesellschaft_Konto.SetFocus
cmdOK.Enabled = False
Exit Sub
End If
If Val(txtBetrag_MwSt.Text)  0 Then
lbMsg = MsgBox("Geben Sie einen negativen Wert oder 0 ein", vbExclamation, " _
falsche Eingabe")
txtBetrag_MwSt.Text = ""
txtBetrag_MwSt.SetFocus
cmdOK.Enabled = False
Exit Sub
End If
End If
Dim nz As Integer, rngZ As Range
nz = Cells(Rows.Count, 1).End(xlUp).Row + 1
For Each rngZ In Rows(nz - 1).SpecialCells(xlCellTypeFormulas)
rngZ.Copy
Cells(nz, rngZ.Column).PasteSpecial Paste:=xlPasteFormulas
Next
Application.CutCopyMode = False
'Application.CutCopyMode = False
'Cells(nz, 1).Select
'Dim nz As Integer
'nz = Cells(Rows.Count, 1).End(xlUp).Row + 1
'Rows(nz - 1).Copy
'Cells(nz, 1).PasteSpecial Paste:=xlPasteFormats
Cells(nz, 1).Value = CDate(Me.txtDatum)
Cells(nz, 2).Value = CDate(Me.txtfaellig_zum)
Cells(nz, 3).Value = Me.cboArt
Cells(nz, 4).Value = Me.txtGegenseite
Cells(nz, 5).Value = Me.txtZahlungsgrund
If Me.cboGesellschaft_Konto = "DA/Allgemeines Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 6).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 11).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Allgemeines Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 7).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 10).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Allgemeines Euro" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 14).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 11).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Allgemeines Euro" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 15).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 10).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Kontokorrent Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 18).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 11).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Kontokorrent Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 19).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 10).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Kontokorrent Euro" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 22).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 11).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Kontokorrent Euro" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 23).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 10).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Treuhand Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 26).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 11).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Treuhand Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 27).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 10).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Treuhand Euro" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 30).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 11).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Treuhand Euro" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 31).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 10).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "AS/Allgemeines Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 34).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AS/Allgemeines Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 35).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "LB/Allgemeines Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 38).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 43).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "LB/Allgemeines Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 39).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 42).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "LB/Allgemeines Euro" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 46).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 43).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "LB/Allgemeines Euro" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 47).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 42).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "LHB/Allgemeines Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 50).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 55).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "LHB/Allgemeines Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 51).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 54).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "LHB/Allgemeines Euro" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 58).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 505).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "LHB/Allgemeines Euro" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 59).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 54).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "AW/Allgemeines Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 62).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AW/Allgemeines Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 63).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AW/Allgemeines Euro" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 66).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AW/Allgemeines Euro" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 67).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AW/Treuhand Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 70).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AW/Treuhand Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 71).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AW/Treuhand Euro" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 74).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AW/Treuhand Euro" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 75).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
Unload Me
Range("A7:CM2000").Sort Key1:=Range("A7"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Columns(1).Find(CDate(Me.txtDatum)).Select
ActiveSheet.Protect Password:="Peter"
SpeedUp (False)
End Sub



Private Sub Label1_Click()
End Sub



Private Sub txtBetrag_Gesellschaft_Konto_AfterUpdate()
OK_True
End Sub



Private Sub txtBetrag_MwSt_AfterUpdate()
OK_True
End Sub



Private Sub txtDatum_AfterUpdate()
If Not IsDate(txtDatum) Then
MsgBox "kein gültiges Datum"
txtDatum = ""
Exit Sub
End If
OK_True
End Sub



Private Sub txtfaellig_zum_AfterUpdate()
If Not IsDate(txtfaellig_zum) Then
MsgBox "kein gültiges Datum"
txtfaellig_zum = ""
Exit Sub
End If
OK_True
End Sub



Private Sub txtGegenseite_AfterUpdate()
OK_True
End Sub



Private Sub txtZahlungsgrund_AfterUpdate()
OK_True
End Sub



Private Sub UserForm_Initialize()
Me.txtDatum = Date
Me.txtfaellig_zum = Empty
With Me.cboArt
.AddItem "-"
.AddItem "-a"
'.AddItem "-/+"
.AddItem "+/-"
.AddItem "+"
.AddItem "+a"
End With
Me.cboArt = "-"
Me.txtGegenseite = Empty
Me.txtZahlungsgrund = Empty
With Me.cboGesellschaft_Konto
.AddItem "DA/Allgemeines Lewa"
.AddItem "DA/Allgemeines Euro"
.AddItem "DA/Kontokorrent Lewa"
.AddItem "DA/Kontokorrent Euro"
.AddItem "DA/Treuhand Lewa"
.AddItem "DA/Treuhand Euro"
.AddItem "AS/Allgemeines Lewa"
.AddItem "LB/Allgemeines Lewa"
.AddItem "LB/Allgemeines Euro"
.AddItem "LHB/Allgemeines Lewa"
.AddItem "LHB/Allgemeines Euro"
.AddItem "AW/Allgemeines Lewa"
.AddItem "AW/Allgemeines Euro"
.AddItem "AW/Treuhand Lewa"
.AddItem "AW/Treuhand Euro"
End With
Me.cboGesellschaft_Konto = "DA/Allgemeines Lewa"
With Me.cboGesellschaft_Konto_intern
.AddItem "DA/Allgemeines Lewa"
.AddItem "DA/Allgemeines Euro"
.AddItem "DA/Kontokorrent Lewa"
.AddItem "DA/Kontokorrent Euro"
.AddItem "DA/Treuhand Lewa"
.AddItem "DA/Treuhand Euro"
.AddItem "AS/Allgemeines Lewa"
.AddItem "LB/Allgemeines Lewa"
.AddItem "LB/Allgemeines Euro"
.AddItem "LHB/Allgemeines Lewa"
.AddItem "LHB/Allgemeines Euro"
.AddItem "AW/Allgemeines Lewa"
.AddItem "AW/Allgemeines Euro"
.AddItem "AW/Treuhand Lewa"
.AddItem "AW/Treuhand Euro"
End With
'Me.cboGesellschaft_Konto_intern = "DA/Allgemeines Lewa"
Me.cboGesellschaft_Konto_intern.Enabled = False
'With Me.cboAusgang_Eingang_Gesellschaft_Konto
'.AddItem "Ausgang"
'.AddItem "Eingang"
'End With
'Me.cboAusgang_Eingang_Gesellschaft_Konto = "Ausgang"
Me.txtBetrag_Gesellschaft_Konto = Empty
Me.txtBetrag_MwSt = Empty
End Sub


9
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Probleme mit Userform, Text berichtigt!
19.06.2007 15:05:16
Peter
Hallo alle zusammen,
ich habe zwei Probleme mit meiner Userform:
1.
in meiner Userform gibt es mehrere Textfelder, Comboboxen und die Commandbutton "OK" und "Abbrechen".
Das Commandbutton "OK" soll Enabled = True werden und der Focus soll auf "OK" stehen, wenn in allen Textfeldern und Comboboxen die Enabled = True sind etwas eingetragen ist.
Der Code vom Sub OK_True() sollte das steuern, funktioniert aber nicht.
2.
Nachdem ich die Eintragungen mit "OK" bestetigt habe bleibt der Code im Sub cmdOK_Click() an der Stelle "If cboArt.Text = "-" Or "-a" Then" hängen.
Warum?
Kann mir jemand helfen?
Danke im Voraus
Grüße aus Berlin
Der Code der Userform:

Private Sub OK_True()
cmdOK.Enabled = True
Dim Ob As MSForms.Control
For Each Ob In Controls
If TypeOf Ob Is MSForms.TextBox Then If Ob.Value = "" Then cmdOK.Enabled = False
If TypeOf Ob Is MSForms.ComboBox Then If Ob.Value = "" Then cmdOK.Enabled = False
Next Ob
If cmdOK.Enabled = True Then cmdOK.SetFocus
End Sub



Private Sub cboArt_AfterUpdate()
OK_True
End Sub



Private Sub cboArt_Change()
Select Case cboArt.Text
Case "+/-"
cboGesellschaft_Konto_intern.Enabled = True
cboGesellschaft_Konto_intern.BackColor = &H80000005
Me.cboGesellschaft_Konto_intern = "DA/Allgemeines Lewa"
Case Else
cboGesellschaft_Konto_intern.Text = ""
cboGesellschaft_Konto_intern.Enabled = False
cboGesellschaft_Konto_intern.BackColor = 14737632
End Select
End Sub



Private Sub cboGesellschaft_Konto_AfterUpdate()
OK_True
End Sub



Private Sub cboGesellschaft_Konto_intern_AfterUpdate()
OK_True
End Sub



Private Sub cboGesellschaft_Konto_Change()
Select Case cboGesellschaft_Konto.Text
Case "AS/Allgemeines Lewa", "AW/Allgemeines Lewa", _
"AW/Allgemeines Euro", "AW/Treuhand Lewa", "AW/Treuhand Euro"
txtBetrag_MwSt.Text = ""
txtBetrag_MwSt.Enabled = False
txtBetrag_MwSt.BackColor = 14737632
Case Else
txtBetrag_MwSt.Enabled = True
txtBetrag_MwSt.BackColor = &H80000005
End Select
End Sub



Private Sub cmdAbbrechen_Click()
Unload Me
End Sub



Private Sub cmdOK_Click()
Dim cell As Range
Dim a As Long
Dim lbMsg As Byte
SpeedUp (True)
ActiveSheet.Unprotect Password:="Peter"
If Not IsDate(txtDatum.Text) = True Then
lbMsg = MsgBox("Geben Sie ein gültiges Datum ein", vbExclamation, "falsche Eingabe") _
_
txtDatum.Text = ""
txtDatum.SetFocus
cmdOK.Enabled = False
Exit Sub
End If
If Not IsDate(txtfaellig_zum.Text) = True Then
lbMsg = MsgBox("Geben Sie ein gültiges Datum ein", vbExclamation, "falsche Eingabe") _
_
txtfaellig_zum.Text = ""
txtfaellig_zum.SetFocus
cmdOK.Enabled = False
Exit Sub
End If
If cboArt.Text = "-" Or "-a" Then
If Val(txtBetrag_Gesellschaft_Konto.Text) > 0 Then
lbMsg = MsgBox("Geben Sie einen negativen Wert ein", vbExclamation, " _
falsche Eingabe")
txtBetrag_Gesellschaft_Konto.Text = ""
txtBetrag_Gesellschaft_Konto.SetFocus
cmdOK.Enabled = False
Exit Sub
End If
If Val(txtBetrag_MwSt.Text)  0 Then
lbMsg = MsgBox("Geben Sie einen negativen Wert oder 0 ein", vbExclamation, " _
_
falsche Eingabe")
txtBetrag_MwSt.Text = ""
txtBetrag_MwSt.SetFocus
cmdOK.Enabled = False
Exit Sub
End If
End If
Dim nz As Integer, rngZ As Range
nz = Cells(Rows.Count, 1).End(xlUp).Row + 1
For Each rngZ In Rows(nz - 1).SpecialCells(xlCellTypeFormulas)
rngZ.Copy
Cells(nz, rngZ.Column).PasteSpecial Paste:=xlPasteFormulas
Next
Application.CutCopyMode = False
'Application.CutCopyMode = False
'Cells(nz, 1).Select
'Dim nz As Integer
'nz = Cells(Rows.Count, 1).End(xlUp).Row + 1
'Rows(nz - 1).Copy
'Cells(nz, 1).PasteSpecial Paste:=xlPasteFormats
Cells(nz, 1).Value = CDate(Me.txtDatum)
Cells(nz, 2).Value = CDate(Me.txtfaellig_zum)
Cells(nz, 3).Value = Me.cboArt
Cells(nz, 4).Value = Me.txtGegenseite
Cells(nz, 5).Value = Me.txtZahlungsgrund
If Me.cboGesellschaft_Konto = "DA/Allgemeines Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 6).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 11).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Allgemeines Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 7).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 10).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Allgemeines Euro" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 14).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 11).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Allgemeines Euro" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 15).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 10).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Kontokorrent Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 18).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 11).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Kontokorrent Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 19).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 10).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Kontokorrent Euro" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 22).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 11).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Kontokorrent Euro" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 23).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 10).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Treuhand Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 26).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 11).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Treuhand Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 27).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 10).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Treuhand Euro" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 30).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 11).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "DA/Treuhand Euro" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 31).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 10).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "AS/Allgemeines Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 34).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AS/Allgemeines Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 35).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "LB/Allgemeines Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 38).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 43).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "LB/Allgemeines Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 39).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 42).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "LB/Allgemeines Euro" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 46).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 43).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "LB/Allgemeines Euro" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 47).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 42).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "LHB/Allgemeines Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 50).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 55).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "LHB/Allgemeines Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 51).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 54).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "LHB/Allgemeines Euro" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 58).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 505).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "LHB/Allgemeines Euro" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 59).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
Cells(nz, 54).Value = CDec(Me.txtBetrag_MwSt)
End If
If Me.cboGesellschaft_Konto = "AW/Allgemeines Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 62).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AW/Allgemeines Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 63).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AW/Allgemeines Euro" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 66).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AW/Allgemeines Euro" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 67).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AW/Treuhand Lewa" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 70).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AW/Treuhand Lewa" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 71).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AW/Treuhand Euro" And Me.cboArt = "-" Or "-a" Then
Cells(nz, 74).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
If Me.cboGesellschaft_Konto = "AW/Treuhand Euro" And Me.cboArt = "+" Or "+a" Then
Cells(nz, 75).Value = CDec(Me.txtBetrag_Gesellschaft_Konto)
End If
Unload Me
Range("A7:CM2000").Sort Key1:=Range("A7"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Columns(1).Find(CDate(Me.txtDatum)).Select
ActiveSheet.Protect Password:="Peter"
SpeedUp (False)
End Sub



Private Sub Label1_Click()
End Sub



Private Sub txtBetrag_Gesellschaft_Konto_AfterUpdate()
OK_True
End Sub



Private Sub txtBetrag_MwSt_AfterUpdate()
OK_True
End Sub



Private Sub txtDatum_AfterUpdate()
If Not IsDate(txtDatum) Then
MsgBox "kein gültiges Datum"
txtDatum = ""
Exit Sub
End If
OK_True
End Sub



Private Sub txtfaellig_zum_AfterUpdate()
If Not IsDate(txtfaellig_zum) Then
MsgBox "kein gültiges Datum"
txtfaellig_zum = ""
Exit Sub
End If
OK_True
End Sub



Private Sub txtGegenseite_AfterUpdate()
OK_True
End Sub



Private Sub txtZahlungsgrund_AfterUpdate()
OK_True
End Sub



Private Sub UserForm_Initialize()
Me.txtDatum = Date
Me.txtfaellig_zum = Empty
With Me.cboArt
.AddItem "-"
.AddItem "-a"
'.AddItem "-/+"
.AddItem "+/-"
.AddItem "+"
.AddItem "+a"
End With
Me.cboArt = "-"
Me.txtGegenseite = Empty
Me.txtZahlungsgrund = Empty
With Me.cboGesellschaft_Konto
.AddItem "DA/Allgemeines Lewa"
.AddItem "DA/Allgemeines Euro"
.AddItem "DA/Kontokorrent Lewa"
.AddItem "DA/Kontokorrent Euro"
.AddItem "DA/Treuhand Lewa"
.AddItem "DA/Treuhand Euro"
.AddItem "AS/Allgemeines Lewa"
.AddItem "LB/Allgemeines Lewa"
.AddItem "LB/Allgemeines Euro"
.AddItem "LHB/Allgemeines Lewa"
.AddItem "LHB/Allgemeines Euro"
.AddItem "AW/Allgemeines Lewa"
.AddItem "AW/Allgemeines Euro"
.AddItem "AW/Treuhand Lewa"
.AddItem "AW/Treuhand Euro"
End With
Me.cboGesellschaft_Konto = "DA/Allgemeines Lewa"
With Me.cboGesellschaft_Konto_intern
.AddItem "DA/Allgemeines Lewa"
.AddItem "DA/Allgemeines Euro"
.AddItem "DA/Kontokorrent Lewa"
.AddItem "DA/Kontokorrent Euro"
.AddItem "DA/Treuhand Lewa"
.AddItem "DA/Treuhand Euro"
.AddItem "AS/Allgemeines Lewa"
.AddItem "LB/Allgemeines Lewa"
.AddItem "LB/Allgemeines Euro"
.AddItem "LHB/Allgemeines Lewa"
.AddItem "LHB/Allgemeines Euro"
.AddItem "AW/Allgemeines Lewa"
.AddItem "AW/Allgemeines Euro"
.AddItem "AW/Treuhand Lewa"
.AddItem "AW/Treuhand Euro"
End With
'Me.cboGesellschaft_Konto_intern = "DA/Allgemeines Lewa"
Me.cboGesellschaft_Konto_intern.Enabled = False
'With Me.cboAusgang_Eingang_Gesellschaft_Konto
'.AddItem "Ausgang"
'.AddItem "Eingang"
'End With
'Me.cboAusgang_Eingang_Gesellschaft_Konto = "Ausgang"
Me.txtBetrag_Gesellschaft_Konto = Empty
Me.txtBetrag_MwSt = Empty
End Sub


Anzeige
AW: Probleme mit Userform, Text berichtigt!
19.06.2007 15:40:21
Tom
Hallo Peter,
versuch mal
If (cboArt.Text = "-") Or (cboArt.Text = "-a") then
Gruß
Tom

AW: Probleme mit Userform, Text berichtigt!
19.06.2007 15:56:27
Peter
Danke Tom, funktioniert.

Erledigt oT
19.06.2007 16:39:50
.
jj

AW: Probleme mit Userform
19.06.2007 15:05:00
BG
Hallo Peter
wer soll das alles nachbauen?
Gruss BG

noch 1 Problem in Userform
19.06.2007 17:25:11
Peter
Hallo,
Problem 1 besteht noch.
Kann mir hier auch noch jemand helfen?
Danke
Grüße aus Berlin

AW: noch 1 Problem in Userform
20.06.2007 01:41:00
Daniel
Hi
ich glaube, du hast vergessen abzufragen, ob die Textbox/Combobox auch enabled ist.
um diesen Punkt musst du deine IF-Ketten in der Sub OK_True noch ergänzen.
Gruß, Daniel

Anzeige
AW: noch 1 Problem in Userform
20.06.2007 17:43:32
Peter
Danke Daniel, funktioniert!

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige