
Private Sub TextBoxEntrata_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsNumeric(Me.TextBoxEntrata.Value) Then
MsgBox "Only numeric values allowed"
Cancel = True
Else
Me.CommandInserimento.Enabled = True
End If
End Sub |
| scossa's web site |
| Se tu hai una mela, ed io ho una mela, e ce le scambiamo, allora tu ed io abbiamo sempre una mela per uno. Ma se tu hai un'idea, ed io ho un'idea, e ce le scambiamo, allora abbiamo entrambi due idee. (George Bernard Shaw) |
Private Sub CommandButton1_Click()
Range("A1").Value = Me.TextBox1.Value * 1
End Sub
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 190 Or KeyCode = 110 Or KeyCode = 188 Then
If InStr(Me.TextBox1.Text, ",") > 0 Then KeyCode = 0 Else KeyCode = 188
End If
End Sub
|
Option Explicit
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Range("A1") = Replace(TextBox1, ",", ".")
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If Chr(KeyAscii) Like "[!0-9,]" Then
KeyAscii = 0
Exit Sub
End If
End Sub |
| scossa's web site |
| Se tu hai una mela, ed io ho una mela, e ce le scambiamo, allora tu ed io abbiamo sempre una mela per uno. Ma se tu hai un'idea, ed io ho un'idea, e ce le scambiamo, allora abbiamo entrambi due idee. (George Bernard Shaw) |
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If IsNumeric(TextBox1.Value) Then Range("A1") = TextBox1.Value * 1
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Debug.Print KeyAscii
If Chr(KeyAscii) Like "[!0-9,]" Then
KeyAscii = 0
Else
If KeyAscii = 44 And InStr(TextBox1.Text, ",") > 0 Then KeyAscii = 0
End If
End Sub
|
Private Sub TextBoxEntrata_Exit(ByVal Cancel As MSForms.ReturnBoolean)
' OnlyNumbers
If Not IsNumeric(Me.TextBoxEntrata.Value) Then
MsgBox "Only numeric values allowed"
Cancel = True
Else
'If Me.TextBoxEntrata.Value <> vbNullString Then
' Me.TextBoxUscita.Enabled = False
Me.TextBoxEntrata = Replace(Me.TextBoxEntrata, ",", ".")
Me.CommandInserimento.Enabled = True
End If
End Sub
Private Sub TextBoxEntrata_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Asc("0") To Asc("9")
Case Asc("-")
If InStr(1, Me.TextBox1.Text, "-") > 0 Or Me.TextBox1.SelStart > 0 Then
KeyAscii = 0
End If
Case Asc(",")
If InStr(1, Me.TextBox1.Text, ".") > 0 Then
KeyAscii = 0
End If
Case Else
KeyAscii = 0
End Select |
Case Asc("0") To Asc("9")
| scossa's web site |
| Se tu hai una mela, ed io ho una mela, e ce le scambiamo, allora tu ed io abbiamo sempre una mela per uno. Ma se tu hai un'idea, ed io ho un'idea, e ce le scambiamo, allora abbiamo entrambi due idee. (George Bernard Shaw) |
'poi bisogna aggiungere una riga al foglio Banca....
With Worksheets("Banca 2015")
NewRowBanca = .Range("A2").End(xlDown).Row + 1
.Cells(NewRowBanca, 1) = Format(Y, "00000")
.Cells(NewRowBanca, 3) = Me.TextBoxDate
.Cells(NewRowBanca, 4) = Me.TextBoxEntrata
.Cells(NewRowBanca, 6) = "Pagamento Bancomat"
' e un'altra riga va aggiunta per le commissioni
NewRowBanca = NewRowBanca + 1
.Cells(NewRowBanca, 1) = Format(Y, "00000")
.Cells(NewRowBanca, 3) = Me.TextBoxDate
.Cells(NewRowBanca, 5) = Me.TextBoxEntrata * 7 / 1000
.Cells(NewRowBanca, 6) = "Commissioni"
'poi bisogna aggiungere una riga al foglio Banca....
With Worksheets("Banca 2015")
NewRowBanca = .Range("A2").End(xlDown).Row + 1
.Cells(NewRowBanca, 1) = Format(Y, "00000")
.Cells(NewRowBanca, 3) = Me.TextBoxDate
.Cells(NewRowBanca, 4) = Me.TextBoxEntrata
.Cells(NewRowBanca, 6) = "Pagamento Bancomat"
' e un'altra riga va aggiunta per le commissioni
NewRowBanca = NewRowBanca + 1
Y = "00026"
.Cells(NewRowBanca, 1) = Format(Y, "00000")
.Cells(NewRowBanca, 3) = Me.TextBoxDate
.Cells(NewRowBanca, 5).FormulaR1C1 = "=R[-1]C[-1]*7/1000"
.Cells(NewRowBanca, 6) = "Commissioni" |
