| | Post: 1 | Registrato il: 14/06/2018
| Città: CASORIA | Età: 59 | Utente Junior | 2013 | | OFFLINE | |
|
14/06/2018 21:53 | |
Buonasera premetto che è la prima volta che scrivo in un forum, il mio problema è il seguente; in una userform ho due textbox in cui inserisco numeri ed una terza textbox in cui devo visualizzare il prodotto dei numeri inseriti nelle prime due textbox, il problema e che non riesco ad aggiornare automaticamente il prodotto ogni volta che cambio i numeri nelle prime due textbox. Spero di essere stato comprensibile e vi ringrazio in anticipo. Ciao a tutti |
|
| | Post: 3.045 | Registrato il: 03/04/2013
| Utente Master | Excel 2000 - 2013 | | OFFLINE | |
|
14/06/2018 22:32 | |
Buona sera, Fabrizio; i TextBox rendono sempre un Valore in Formato "Testo". Per capire meglio quello che vuoi ottenere, a mè, serve il tuo File, senza Dati sensibili, ma con tutte le caratteristiche peculiari e le precise indicazioni di quello che desideri ottenere. Buona serata. Giuseppe
Windows XP - Excel 2000
Windows 10 - Excel 2013 |
| | Post: 3.771 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
14/06/2018 22:34 | |
Fabrizio allega un file con la userform con le textbox.
I modi possono essere diversi: ad esempio sfruttare gli eventi Change, oppure Exit oppure BeforeUpdate delle textbox.
Edit: Ciao Giuseppe ogni tanto ci si incontra [Modificato da alfrimpa 14/06/2018 22:36]
Alfredo |
| | Post: 3.541 | Registrato il: 28/06/2011
| Città: AGORDO | Età: 70 | Utente Master | 2013 | | OFFLINE | |
|
14/06/2018 22:39 | |
Senza allegato...
A parte il codice, dell'userform = textbox = testo (per 1) =numero
Casomai tra le due textbox (esiste il SetFocus "VBA per aggiornare i dati")
Poi non capiso il motivo d'usare sempre il VBA, forse solo celle...con adeguate spiegazioni Excel 2013 |
| | Post: 1 | Registrato il: 14/06/2018
| Città: CASORIA | Età: 59 | Utente Junior | 2013 | | OFFLINE | |
|
15/06/2018 11:07 | |
in allegato il file di prova.
grazie per l'aiuto
Fabrizio |
| | Post: 3.048 | Registrato il: 03/04/2013
| Utente Master | Excel 2000 - 2013 | | OFFLINE | |
|
15/06/2018 11:44 | |
Buona giornata a Tutti.
Si potebbe provare con:
Option Explicit
Private Sub txtQuantità_Change()
If txtQuantità.Value <> "" And txtPrezzo.Value <> "" And txtSconto.Value <> "" Then Call Calcola
End Sub
Private Sub txtPrezzo_Change()
If txtQuantità.Value <> "" And txtPrezzo.Value <> "" And txtSconto.Value <> "" Then Call Calcola
End Sub
Private Sub txtSconto_Change()
If txtQuantità.Value <> "" And txtPrezzo.Value <> "" And txtSconto.Value <> "" Then Call Calcola
End Sub
Sub Calcola()
txtImporto.Value = (txtQuantità.Value * 1 * txtPrezzo.Value * 1) - ((txtQuantità.Value * 1 * txtPrezzo.Value * 1) * txtSconto / 100)
End Sub
Mi sono preso la libertà di modificare il (Name) da txtQuantita a txtQuantità; poi, ovviamente, vedi tu.
Giuseppe
Windows XP - Excel 2000
Windows 10 - Excel 2013 |
| | Post: 3.542 | Registrato il: 28/06/2011
| Città: AGORDO | Età: 70 | Utente Master | 2013 | | OFFLINE | |
|
15/06/2018 11:51 | |
Elimina il Change, inseririsci un bottone, dovrebbe essere CommandButton1_Click
vb Private Sub CommandButton1_Click()
A = txtQuantita.Text * 1
B = txtPrezzo.Text * 1
C = txtSconto.Text * 1
txtImporto = (A * B) - C
End Sub
Sono sempre in ritardo da Giuseppe(ciao) Excel 2013 |
| | Post: 2 | Registrato il: 14/06/2018
| Città: CASORIA | Età: 59 | Utente Junior | 2013 | | OFFLINE | |
|
15/06/2018 12:25 | |
grazie Giuseppe funziona! |
|
|