Thema Datum  Von Nutzer Rating
Antwort
Rot VBA
25.09.2012 09:39:41 Niklas
NotSolved
Blau VBA
25.09.2012 11:23:30 ferdi
NotSolved
Rot VBA
25.09.2012 13:07:35 Dekor
NotSolved
Blau VBA
25.09.2012 14:37:40 Niklas
NotSolved
Rot VBA
26.09.2012 12:26:28 Dekor
*****
NotSolved
Blau VBA
26.09.2012 12:39:43 Niklas
NotSolved
Rot VBA
26.09.2012 12:53:42 Dekor
NotSolved
Blau VBA
26.09.2012 12:58:04 Niklas
NotSolved
Rot VBA
26.09.2012 13:04:19 Gast14507
NotSolved
Blau VBA
26.09.2012 13:36:09 Niklas
NotSolved
Rot VBA
26.09.2012 20:39:20 Till
NotSolved
Blau VBA
26.09.2012 20:24:58 Dekor
NotSolved
Rot VBA
26.09.2012 20:29:25 Dekor
NotSolved
Blau VBA
26.09.2012 20:50:48 Till
NotSolved
Rot VBA
26.09.2012 21:23:44 Dekor
NotSolved
Blau VBA
27.09.2012 10:05:25 Niklas
NotSolved
Rot VBA
27.09.2012 11:10:10 Till
NotSolved
Blau VBA
27.09.2012 12:32:19 Dekor
NotSolved
Rot VBA
27.09.2012 12:35:04 Dekor
NotSolved
Blau VBA
27.09.2012 13:19:49 Gast88555
NotSolved
Rot VBA
27.09.2012 13:22:02 Niklas
NotSolved
Blau VBA
27.09.2012 16:24:11 Till
NotSolved
Rot VBA
27.09.2012 17:58:26 Niklas
NotSolved
Blau VBA
27.09.2012 18:28:25 Till
NotSolved
Rot VBA
27.09.2012 18:38:03 Niklas
NotSolved
Blau VBA
27.09.2012 18:45:06 Niklas
NotSolved
Rot VBA
27.09.2012 21:23:18 Till
NotSolved
Blau VBA
28.09.2012 09:12:08 Niklas
NotSolved
Rot VBA
28.09.2012 12:42:03 Gast43175
NotSolved
Blau VBA
28.09.2012 09:10:04 Niklas
NotSolved
Rot VBA
28.09.2012 18:17:37 Till
NotSolved
Blau VBA
28.09.2012 19:24:30 Niklas
NotSolved
Rot VBA
28.09.2012 21:16:06 Till
NotSolved
Blau VBA
10.10.2012 11:13:24 Niklas
NotSolved
Rot VBA
11.10.2012 09:27:58 Niklas
NotSolved
Blau VBA
10.10.2012 11:47:12 Gast884
NotSolved
Rot VBA
11.10.2012 06:13:51 Till
NotSolved
Blau VBA
11.10.2012 08:50:55 Niklas
NotSolved
Rot VBA
11.10.2012 09:15:51 Niklas
NotSolved
Blau VBA
12.10.2012 23:55:02 Till
NotSolved
Rot VBA
13.10.2012 22:39:06 Niklas
NotSolved
Blau VBA
14.10.2012 23:47:49 Till
NotSolved
Rot VBA
15.10.2012 09:19:00 Niklas
NotSolved
Blau VBA
15.10.2012 11:34:04 Till
NotSolved
Rot VBA
15.10.2012 13:40:41 Niklas
NotSolved
Blau VBA
15.10.2012 15:15:20 Niklas
NotSolved
Rot VBA
15.10.2012 20:20:40 Till
NotSolved
Blau Blau VBA
15.10.2012 20:25:39 Niklas
NotSolved

Ansicht des Beitrags:
Von:
Till
Datum:
26.09.2012 20:50:48
Views:
1449
Rating: Antwort:
  Ja
Thema:
VBA

Hallo Detlev,

grade erst deinen neuen Beitrag gesehen, eine Prozedur dafür zu verwenden ist natürlich besser als meine Lösung, welche auch garnicht so funktioniert, wie ich grade festgestellt habe. Bin bei dir allerdings auch skeptisch, woher nimmst du die Variable "tb1"?

Ich würd's so machen:

'check if value is numeric and stop if it isnt
Private Sub Check(str$, Key As MSForms.ReturnInteger)
    If Not IsNumeric(str & Chr(Key)) Then
        Key = 0
        Beep
    End If
End Sub

Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Check ActiveControl.Text, KeyAscii
End Sub

Insgesamt dann so:

Option Explicit

Dim Bereich As Range
Dim Zellen() As Range

Private Sub UserForm_Initialize()
    ZellenEinlesen
End Sub
Private Sub UserForm_Activate()
    'Erstes Auswahlfeld Markieren
    With TextBox2
        .SetFocus
        .SelStart = 0
        .SelLength = Len(.Text)
    End With
     
    'Überschrift
    Me.TextBox1.Value = ActiveSheet.Range("B36").Text
    
    Dim i%
    For i = 0 To 11
       Me.Controls("TextBox" & i + 2).Text = Zellen(i).Value
    Next
     
End Sub
Private Sub ZellenEinlesen()
    Dim E1%, E2%

    Set Bereich = Range("E28:G31")
    With Bereich
        E1 = .Rows.Count
        E2 = .Columns.Count
    End With
    
    ReDim Zellen(E1 * E2 - 1)
    Dim r%, c%, i%
    For r = 1 To E1
        For c = 1 To E2
            Set Zellen(i) = Bereich(r, c)
            i = i + 1
        Next
    Next

End Sub

Private Sub CommandButton1_Click()
    
    Dim i%
    For i = 2 To 13
        If Me.Controls("TextBox" & i).Text = "" Then
            MsgBox ("Bitte einen Wert eingeben")
            Exit For
        End If
    Next
    If i > 13 Then Exit Sub
    
    For i = 0 To 11
        Zellen(i).Value = Me.Controls("TextBox" & i + 2).Text
    Next
        
    UF_Tabelle_01.Hide 'hier eintragen
End Sub
Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
    CommandButton1.SetFocus
End Sub
Private Sub CommandButton2_Click()
    UF_Tabelle_01.Hide 'hier eintragen
End Sub
Private Sub CommandButton2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
    CommandButton2.SetFocus
End Sub
Private Sub CommandButton3_Click()
    
    Dim x As Range
    For Each x In Zellen
        x = 0
    Next
    
    Unload Me
    UF_Tabelle_01.Show 'hier eintragen
End Sub
Private Sub CommandButton3_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
    CommandButton3.SetFocus
End Sub

'check if value is numeric and stop if it isnt
Private Sub Check(str$, Key As MSForms.ReturnInteger)
    If Not IsNumeric(str & Chr(Key)) Then
        Key = 0
        Beep
    End If
End Sub

Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Check ActiveControl.Text, KeyAscii
End Sub
Private Sub TextBox3_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Check ActiveControl.Text, KeyAscii
End Sub
Private Sub TextBox4_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Check ActiveControl.Text, KeyAscii
End Sub
Private Sub TextBox5_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Check ActiveControl.Text, KeyAscii
End Sub
Private Sub TextBox6_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Check ActiveControl.Text, KeyAscii
End Sub
Private Sub TextBox7_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Check ActiveControl.Text, KeyAscii
End Sub
Private Sub TextBox8_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Check ActiveControl.Text, KeyAscii
End Sub
Private Sub TextBox9_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Check ActiveControl.Text, KeyAscii
End Sub
Private Sub TextBox10_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Check ActiveControl.Text, KeyAscii
End Sub
Private Sub TextBox11_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Check ActiveControl.Text, KeyAscii
End Sub
Private Sub TextBox12_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Check ActiveControl.Text, KeyAscii
End Sub
Private Sub TextBox13_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Check ActiveControl.Text, KeyAscii
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 VBA
25.09.2012 09:39:41 Niklas
NotSolved
Blau VBA
25.09.2012 11:23:30 ferdi
NotSolved
Rot VBA
25.09.2012 13:07:35 Dekor
NotSolved
Blau VBA
25.09.2012 14:37:40 Niklas
NotSolved
Rot VBA
26.09.2012 12:26:28 Dekor
*****
NotSolved
Blau VBA
26.09.2012 12:39:43 Niklas
NotSolved
Rot VBA
26.09.2012 12:53:42 Dekor
NotSolved
Blau VBA
26.09.2012 12:58:04 Niklas
NotSolved
Rot VBA
26.09.2012 13:04:19 Gast14507
NotSolved
Blau VBA
26.09.2012 13:36:09 Niklas
NotSolved
Rot VBA
26.09.2012 20:39:20 Till
NotSolved
Blau VBA
26.09.2012 20:24:58 Dekor
NotSolved
Rot VBA
26.09.2012 20:29:25 Dekor
NotSolved
Blau VBA
26.09.2012 20:50:48 Till
NotSolved
Rot VBA
26.09.2012 21:23:44 Dekor
NotSolved
Blau VBA
27.09.2012 10:05:25 Niklas
NotSolved
Rot VBA
27.09.2012 11:10:10 Till
NotSolved
Blau VBA
27.09.2012 12:32:19 Dekor
NotSolved
Rot VBA
27.09.2012 12:35:04 Dekor
NotSolved
Blau VBA
27.09.2012 13:19:49 Gast88555
NotSolved
Rot VBA
27.09.2012 13:22:02 Niklas
NotSolved
Blau VBA
27.09.2012 16:24:11 Till
NotSolved
Rot VBA
27.09.2012 17:58:26 Niklas
NotSolved
Blau VBA
27.09.2012 18:28:25 Till
NotSolved
Rot VBA
27.09.2012 18:38:03 Niklas
NotSolved
Blau VBA
27.09.2012 18:45:06 Niklas
NotSolved
Rot VBA
27.09.2012 21:23:18 Till
NotSolved
Blau VBA
28.09.2012 09:12:08 Niklas
NotSolved
Rot VBA
28.09.2012 12:42:03 Gast43175
NotSolved
Blau VBA
28.09.2012 09:10:04 Niklas
NotSolved
Rot VBA
28.09.2012 18:17:37 Till
NotSolved
Blau VBA
28.09.2012 19:24:30 Niklas
NotSolved
Rot VBA
28.09.2012 21:16:06 Till
NotSolved
Blau VBA
10.10.2012 11:13:24 Niklas
NotSolved
Rot VBA
11.10.2012 09:27:58 Niklas
NotSolved
Blau VBA
10.10.2012 11:47:12 Gast884
NotSolved
Rot VBA
11.10.2012 06:13:51 Till
NotSolved
Blau VBA
11.10.2012 08:50:55 Niklas
NotSolved
Rot VBA
11.10.2012 09:15:51 Niklas
NotSolved
Blau VBA
12.10.2012 23:55:02 Till
NotSolved
Rot VBA
13.10.2012 22:39:06 Niklas
NotSolved
Blau VBA
14.10.2012 23:47:49 Till
NotSolved
Rot VBA
15.10.2012 09:19:00 Niklas
NotSolved
Blau VBA
15.10.2012 11:34:04 Till
NotSolved
Rot VBA
15.10.2012 13:40:41 Niklas
NotSolved
Blau VBA
15.10.2012 15:15:20 Niklas
NotSolved
Rot VBA
15.10.2012 20:20:40 Till
NotSolved
Blau Blau VBA
15.10.2012 20:25:39 Niklas
NotSolved