title: Making VBA Form specific TextBox accept Numbers only and also "."
body: <p>I want to block some specific textboxes has numeric values only and accept ".". However, it blocks almost all my textboxes in my userform. I don't understand why. What I forgot in my code?</p>
  
  <pre><code>Private Sub tbxHour_Exit(ByVal Cancel As MSForms.ReturnBoolean)
  
  'Making TextBox accept Numbers only
  
  If Not IsNumeric(tbxHour.Value) Then
      MsgBox "only numbers allowed"
      Cancel = True
  End If
  
  End Sub
  
  Private Sub tbxHour_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
  
  
  Select Case KeyAscii
      Case 46
          If InStr(1, tbxHour, ".") &gt; 0 Then KeyAscii = 0
      Case 48 To 57
      Case Else
          KeyAscii = 0
  End Select
  
  End Sub
  </code></pre>