Thema Datum  Von Nutzer Rating
Antwort
Rot Userform Daten (Zahlen) werden nicht erkannt
26.09.2015 13:10:11 julz
NotSolved
26.09.2015 16:50:50 Gast10909
*
NotSolved
28.09.2015 12:35:21 julz
NotSolved
28.09.2015 23:07:25 julz
NotSolved

Ansicht des Beitrags:
Von:
julz
Datum:
26.09.2015 13:10:11
Views:
1799
Rating: Antwort:
  Ja
Thema:
Userform Daten (Zahlen) werden nicht erkannt

Hallo!

Ich bin ein VBA Anfänger und habe folgendes Problem:

Wenn ich Daten über meine Userform eingebe werden diese zunächst von der Tabelle nicht "erkannt". Bsp: Eingabe von "2,5" über eine Userform ComboBox steht dann zwar in der entsprechenden Zelle, aber in einer weiteren Tabelle, die Werte summiert, wird es nicht als Wert erkannt. Erst wenn ich die Zelle einmal doppelklicke wird es auch von der anderen Tabelle summiert. Genauso mit dem Datum was ich in der Form tt-mm eingeben lasse. Nach doppelklick wird es als Datum umformatiert. Wie kommt das? Was mach ich falsch?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
Private Sub ComboBox1_Change()
 
End Sub
 
 
Private Sub ListBox1_Click()
 
End Sub
 
Private Sub Label4_Click()
 
End Sub
 
Private Sub TextBox3_Change()
 
End Sub
 
Private Sub TextBox6_Change()
 
End Sub
 
Private Sub UserForm_Initialize()
'when the Userform is initialized, set focus to TextBox6
 Me.TextBox6.SetFocus
  'fill ComboBox
    With Me.ComboBox3
.AddItem "JM"
.AddItem "MK"
.AddItem "BH"
 
.ListIndex = 0
End With
 
  With Me.ComboBox1
  .AddItem "EIKS_AB"
.AddItem "PV_JIRA_WF"
.AddItem "PMO"
.AddItem "Projektmanagement"
.AddItem "PMO_WIKI"
.AddItem "Sonstiges"
.ListIndex = 3
  End With
   
  With Me.ComboBox2
.AddItem "0,5"
.AddItem "1,0"
.AddItem "1,5"
.AddItem "2,0"
.AddItem "2,5"
.AddItem "3,0"
.AddItem "3,5"
.AddItem "4,0"
.AddItem "4,5"
.AddItem "5,0"
.AddItem "5,5"
.AddItem "6,0"
.AddItem "6,5"
.AddItem "7,0"
.AddItem "7,5"
.AddItem "8,0"
.AddItem "8,5"
.ListIndex = 4
End With
 
   
End Sub
Private Sub CommandButton1_Click()
 
           Dim i As Integer
 
    'position cursor in the correct cell A2.
      Sheets("Display").Activate
      Range("A2").Select
    i = 1 'set as the first ID
 
    'validate if data has been entered
    If Me.TextBox3.Text = Empty Then 'Datum
        MsgBox "Bitte Datum eingeben.", vbExclamation
        Me.TextBox3.SetFocus 'position cursor to try again
        Exit Sub 'terminate here - why continue?
          End If
  
If Len(TextBox3.Text) < 5 Then 'Datum
        MsgBox "Bitte überprüfe die Datums Eingabe.", vbExclamation
        Me.TextBox3.SetFocus
        Exit Sub
    End If
 
If Len(TextBox3.Text) > 5 Then 'Datum
        MsgBox "Bitte überprüfe die Datums Eingabe.", vbExclamation
        Me.TextBox3.SetFocus
        Exit Sub
    End If
  
   If Me.ComboBox1.Text = Empty Then 'Projekt
        MsgBox "Bitte Projekt auswählen.", vbExclamation
        Me.ComboBox1.SetFocus 'position cursor to try again
        Exit Sub 'terminate here - why continue?
    End If
     
    If Me.ComboBox2.Value = Empty Then 'Stunden
        MsgBox "Bitte Stunden auswählen.", vbExclamation
        Me.ComboBox2.SetFocus 'position cursor to try again
        Exit Sub 'terminate here - why continue?
    End If
 
 
    If Me.ComboBox3.Text = Empty Then 'Mitarbeiter
        MsgBox "Bitte Mitarbeiter Kürzel auswählen.", vbExclamation
        Me.ComboBox3.SetFocus 'position cursor to try again
        Exit Sub 'terminate here - why continue?
    End If
          
    Dim strPass As String
 
strPass = "student"
     
    If Me.TextBox6.Text = Empty Then 'Passwort
        MsgBox "Bitte Passwort eingeben.", vbExclamation
        Me.TextBox6.SetFocus 'position cursor to try again
        Exit Sub 'terminate here - why continue?
    End If
 
If Me.TextBox6.Text = strPass Then 'Passwort
        MsgBox "Ihre Eingabe wurde gespeichert. Änderungen können nur als Administrator vorgenommen werden.", vbExclamation
        UnProtected = True
       Else
    If MsgBox("Das Passwort ist falsch. Bitte geben Sie das richtige Passwort ein.", vbYesNo) = vbNo Then
        Unload Me
    Else
        Exit Sub
    End If
End If
 
 
         
    'if all the above are false (OK) then carry on.
    'check to see the next available blank row start at cell A2...
    Do Until ActiveCell.Value = Empty
        ActiveCell.Offset(1, 0).Select 'move down 1 row
        i = i + 1 'keep a count of the ID for later use
    Loop
 
    'Populate the new data values into the 'Data' worksheet.
     
     ActiveCell.Value = Me.TextBox3.Text 'set col A
    ActiveCell.Offset(0, 1).Value = Me.ComboBox1.Text 'set col B
    ActiveCell.Offset(0, 2).Value = Me.ComboBox2.Value 'set col C
    ActiveCell.Offset(0, 3).Value = Me.ComboBox3.Text 'set col D
    ActiveCell.Offset(0, 4).Value = Me.TextBox5.Text 'set col E
 
 
'End and make new entry
   ActiveWorkbook.Worksheets("Display").ListObjects("Tabelle1").Sort.SortFields. _
        Clear
    ActiveWorkbook.Worksheets("Display").ListObjects("Tabelle1").Sort.SortFields. _
        Add Key:=Range("Tabelle1[[#All],[Datum]]"), SortOn:=xlSortOnValues, Order _
        :=xlDescending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Display").ListObjects("Tabelle1").Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
   ActiveWorkbook.Save
 
    
    'Clear down the values ready for the next record entry...
    Me.ComboBox1.Text = Empty
      
   Me.TextBox3.Text = Empty
Me.TextBox5.Text = Empty
 
 
    Me.TextBox3.SetFocus 'positions the cursor for next record entry
 
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not UnProtected Then Mitarbeiter1.Show
End Sub
 
       
 
'Beenden Schaltfläche Ereignisroutine
Private Sub CommandButton2_Click()
     Unload Me
End Sub

 


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
Rot Userform Daten (Zahlen) werden nicht erkannt
26.09.2015 13:10:11 julz
NotSolved
26.09.2015 16:50:50 Gast10909
*
NotSolved
28.09.2015 12:35:21 julz
NotSolved
28.09.2015 23:07:25 julz
NotSolved