| | Post: 75 | Registrato il: 20/02/2015
| Età: 50 | Utente Junior | 2007 / 2010 | | OFFLINE | |
|
17/03/2021 15:36 | |
salve a tutti,
devo creare una scheda da inviare a varie persone dove verranno inseriti i dati anagrafici
Dovrei fare in modo che loro compilino il dato normalmente, ma il risultato sia diviso parola per parola trasformarlo anche in maiuscolo
allego file
se possibile vorrei che compilando in B, automaticamente da B in poi avvenga la trasformazione |
|
| | Post: 4.619 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
17/03/2021 15:58 | |
Inserisci questo codice nel modulo del foglio1
vb Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
Dim uc As Integer
If Not Intersect(Target, Range("B:B")) Is Nothing Then
Range(Cells(Target.Row, "C"), Cells(Target.Row, "K")).ClearContents
For i = 1 To Len(Target.Value)
uc = Cells(Target.Row, Columns.Count).End(xlToLeft).Column
If Mid(Target.Value, i, 1) <> "/" Then
Cells(Target.Row, uc + 1).Value = UCase(Mid(Target.Value, i, 1))
End If
Next i
End If
End Sub
Alfredo |
| | Post: 75 | Registrato il: 20/02/2015
| Età: 50 | Utente Junior | 2007 / 2010 | | OFFLINE | |
|
17/03/2021 16:42 | |
alfrimpa, 17/03/2021 15:58:
Inserisci questo codice nel modulo del foglio1
vb Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
Dim uc As Integer
If Not Intersect(Target, Range("B:B")) Is Nothing Then
Range(Cells(Target.Row, "C"), Cells(Target.Row, "K")).ClearContents
For i = 1 To Len(Target.Value)
uc = Cells(Target.Row, Columns.Count).End(xlToLeft).Column
If Mid(Target.Value, i, 1) <> "/" Then
Cells(Target.Row, uc + 1).Value = UCase(Mid(Target.Value, i, 1))
End If
Next i
End If
End Sub
perfetta, per quello che ho chiesto
ma se volessi "obbligare" xls a scrivere direttamente le parole divise come nei classici bollettini, è fattibile ?
|
| | Post: 4.620 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
17/03/2021 17:44 | |
Se ho capito prova con questa
vb Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
Dim uc As Integer
Dim str As String
On Error GoTo Errore
If Not Intersect(Target, Range("B:B")) Is Nothing Then
Application.EnableEvents = False
Range(Cells(Target.Row, "c"), Cells(Target.Row, "Z")).ClearContents
str = Target.Value
Target.Value = UCase(Left(Target.Value, 1))
For i = 2 To Len(str)
uc = Cells(Target.Row, Columns.Count).End(xlToLeft).Column
If Mid(str, i, 1) <> "/" Then
Cells(Target.Row, uc + 1).Value = UCase(Mid(str, i, 1))
End If
Next i
End If
Application.EnableEvents = True
Errore:
Application.EnableEvents = True
End Sub
La cella B4 deve essere formattata Generale [Modificato da alfrimpa 17/03/2021 18:23]
Alfredo |
| | Post: 76 | Registrato il: 20/02/2015
| Età: 50 | Utente Junior | 2007 / 2010 | | OFFLINE | |
|
17/03/2021 18:01 | |
alfrimpa, 17/03/2021 17:44:
Se ho capito prova con questa
vb Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
Dim uc As Integer
Dim str As String
On Error GoTo Errore
If Not Intersect(Target, Range("B:B")) Is Nothing Then
Application.EnableEvents = False
Range(Cells(Target.Row, "c"), Cells(Target.Row, "K")).ClearContents
str = Target.Value
Target.Value = UCase(Left(Target.Value, 1))
For i = 2 To Len(str)
uc = Cells(Target.Row, Columns.Count).End(xlToLeft).Column
If Mid(str, i, 1) <> "/" Then
Cells(Target.Row, uc + 1).Value = UCase(Mid(str, i, 1))
End If
Next i
End If
Application.EnableEvents = True
Errore:
Application.EnableEvents = True
End Sub
La cella B4 deve essere formattata Generale
Alfredo, perdona la mia ignoranza, ma non ho capito questa come funziona
Metto un altro file di esempio, sperando di essere più chiaro
chi compila in B2, B4, B6 e B8, scriverà quello che deve, ma verrà automaticamente diviso.
La parola per intero nella cella non deve mai essere presente
[Modificato da mapero 17/03/2021 18:13] |
| | Post: 4.621 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
17/03/2021 18:24 | |
Ma la macro l'hai provata?
Nel file che hai allegato non c'è.
In B2 scrivi mario e vedi cosa succede.
Alfredo |
| | Post: 77 | Registrato il: 20/02/2015
| Età: 50 | Utente Junior | 2007 / 2010 | | OFFLINE | |
|
17/03/2021 18:32 | |
alfrimpa, 17/03/2021 18:24:
Ma la macro l'hai provata?
si l'ho provata, ma credo di aver incasinato le macro perchè non sono molto ferrato in merito.
Se voglio che non mi conservi una macro ogni volta che apro un nuovo file xls come devo fare?
non so salvare il file con la macro
|
| | Post: 4.622 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
17/03/2021 18:35 | |
Fai una ricerca con Google e troverai milioni di link che ti dicono come salvare un file con le macro.
Siamo a meno dell'ABC di Excel.
Alfredo |
| | Post: 78 | Registrato il: 20/02/2015
| Età: 50 | Utente Junior | 2007 / 2010 | | OFFLINE | |
|
17/03/2021 18:39 | |
alfrimpa, 17/03/2021 18:35:
Fai una ricerca con Google e troverai milioni di link che ti dicono come salvare un file con le macro.
Siamo a meno dell'ABC di Excel.
purtroppo siamo ai numeri negativi nel mio caso
eccolo...
|
| | Post: 4.623 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
17/03/2021 18:51 | |
E infatti l'ultimo file allegato, per come ho capito, funziona.
Cosa non ti torna?
Alfredo |
| | Post: 4.624 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
17/03/2021 18:56 | |
mapero, 17/03/2021 18:39:
purtroppo siamo ai numeri negativi nel mio caso
Questa non è una giustificazione ma una condizione che si risolve con un po' di spirito di iniziativa cercando di documentarsi (con Google) per acquisire le conoscenze minime per usare Excel.
Alfredo |
| | Post: 79 | Registrato il: 20/02/2015
| Età: 50 | Utente Junior | 2007 / 2010 | | OFFLINE | |
|
17/03/2021 18:57 | |
alfrimpa, 17/03/2021 18:51:
E infatti l'ultimo file allegato, per come ho capito, funziona.
Cosa non ti torna?
a me non succede nulla
in B scrivo "mario" e lì rimane
|
| | Post: 4.625 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
17/03/2021 19:11 | |
|
| | Post: 80 | Registrato il: 20/02/2015
| Età: 50 | Utente Junior | 2007 / 2010 | | OFFLINE | |
|
17/03/2021 19:13 | |
alfrimpa, 17/03/2021 19:11:
Riallego il file
così funge
per me un mistero
grazie mille Alfredo, soprattutto per la comprensione
|
| | Post: 4.626 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
17/03/2021 19:38 | |
mapero, 17/03/2021 19:13:
così funge
per me un mistero
grazie mille Alfredo, soprattutto per la comprensione
Non è un mistero ma spiegarti perchè non ti funzionava è complicato.
In ogni caso resta valido il consiglio che prima di chiedere sui forum vanno fatti tutti i tentativi possibili per risolvere il problema e solo così si impara ad essere un po' più autonomi e non dipendere in toto dai forum.
Alfredo |
|
|