| | Post: 1 | Registrato il: 17/11/2017
| Città: MILANO | Età: 38 | Utente Junior | 2016 | | OFFLINE | |
|
21/06/2018 11:34 | |
Buongiorno a tutti,
ho creato un file excel che oltre a facilitarmi i calcoli per la creazione di preventivi, si auto-predisponesse
all’importazione dati nel mio programma di contabilità.
Questa predisposizione è riportata nella scheda chiamata “articoli”. Tutto funziona ma il problema è che il mio programma contabile “legge” anche le righe con formule riportando errori che mandano in crash il tutto, mentre ho notato che se vado a cancellare le righe “vuote” manualmente non accade.
Ora ho gia provato a registrare una macro dove premendo un pulsante, mi andasse a copiare la predisposizione e incollasse in una nuova scheda riportando solo i valori; ma il problema persiste perche anche facendo cosi in effetti excel mantiene comunque le celle “piene”; non so di cosa visto che le si può vedere vuote, ma qualcosa mantiene. Questa è stata la mia idea per risolvere ma come ho spiegato non funziona.
Mi rendo conto che forse non sono stato chiaro a sufficienza ma purtroppo è anche difficile spiegarsi.
Chiedo consiglio a voi esperti su cosa posso fare per riportare in una scheda solo le righe compilate nella scheda “articoli”.
Sono disponibile a darvi ulteriori spiegazioni sia scritte ma anche a voce con chiunque avesse la cortesia di aiutarmi e ringrazio anticipatamente.
|
|
| | Post: 3.788 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
21/06/2018 12:12 | |
Ciao Maelstrom85
Effettivamente molto chiaro non sei stato.
Riesci a fare un esempio (costruendolo manualmente) di come la scheda "Preventivi" debba essere creata affinché non dia problemi al tuo gestionale?
Alfredo |
| | Post: 1 | Registrato il: 17/11/2017
| Città: MILANO | Età: 38 | Utente Junior | 2016 | | OFFLINE | |
|
21/06/2018 14:25 | |
alfrimpa, 21/06/2018 12.12:
Ciao Maelstrom85
Effettivamente molto chiaro non sei stato.
Riesci a fare un esempio (costruendolo manualmente) di come la scheda "Preventivi" debba essere creata affinché non dia problemi al tuo gestionale?
si allora,
puoi notare che nella scheda preventivi se ti posizioni nella casella a6 puoi selezionare dal menu a tendina un materiale giusto? una volta selezionato, in b6,c6 e d5 puoi mettere le dimensioni in mm e il quantitativo. ora, passa alla scheda "articoli" vedrai che si è autocompilata riga 3. questa riga come le altre che si autocompilano, vengono prese dal mio programma di contabilità e non da problemi.
il pasticcio avviene (nel nostro caso) nelle righe seguenti ovvero dalla 4 in poi perche non sono presenti materiali;
quindi nel rigo 4 vi è presente solo la formula che prende dati dalla scheda "preventivi"
il mio programma importa queste righe non compilate andando in crash.
ma ho visto che, se le righe sono totalmente vuote (cancellandole manualmente), non ci sono problemi.
spero di essermi spiegato un po meglio |
| | Post: 3.791 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
21/06/2018 15:45 | |
Ciao maelstroom
Premetto che non sono sicuro di aver capito bene.
Ti allego il tuo file dove ho aggiunto un nuovo foglio "Gestionale" identico a "preventivi" ma senza formule.
Quando hai terminato di compilare il foglio "Preventivi" clicca sul pulsante "Crea scheda per gestionale" e il foglio "gestionale" verrà compilato senza la necessità di alcuna formula.
Questo il codice abbinato al pulsante
vb Sub PerGestionale()
Dim i As Integer
Dim ur As Integer
Dim rng As Range
Dim cel As Range
Set rng = Sheets("Preventivi").Range("A5:a20")
Sheets("Gestionale").Range("a5:K20").ClearContents
For Each cel In rng
ur = Sheets("Gestionale").Range("a3").End(xlDown).Row
If cel.Value <> "" Then
For i = 1 To 11
Sheets("Gestionale").Cells(ur + 1, i).Value = cel.Offset(0, i - 1).Value
Next i
End If
Next cel
Sheets("Gestionale").Range("F21").Value = Sheets("Preventivi").Range("F21").Value
Sheets("Gestionale").Range("B23").Value = Sheets("Preventivi").Range("B23").Value
Sheets("Gestionale").Range("D23").Value = Sheets("Preventivi").Range("D23").Value
Sheets("Gestionale").Range("K23").Value = Sheets("Preventivi").Range("K23").Value
End Sub
Fai sapere era ciò quello che volevi.
Alfredo |
| | Post: 5.426 | Registrato il: 14/11/2004
| Utente Master | Office 2019 | | OFFLINE |
|
21/06/2018 16:15 | |
Ciao Alfredo credo che vorrebbe i dati come il foglio Articoli perche è quello che viene passato al suo gestionale, non un nuovo foglio preventivo.
Ciao By Sal
[Modificato da by sal 21/06/2018 16:18] se ti piace la soluzione sostienici con una DONAZIONE a piacere. Grazie clicca qui |
| | Post: 2 | Registrato il: 17/11/2017
| Città: MILANO | Età: 38 | Utente Junior | 2016 | | OFFLINE | |
|
21/06/2018 17:00 | |
alfrimpa, 21/06/2018 15.45:
Ciao maelstroom
Premetto che non sono sicuro di aver capito bene.
Ti allego il tuo file dove ho aggiunto un nuovo foglio "Gestionale" identico a "preventivi" ma senza formule.
Quando hai terminato di compilare il foglio "Preventivi" clicca sul pulsante "Crea scheda per gestionale" e il foglio "gestionale" verrà compilato senza la necessità di alcuna formula.
Questo il codice abbinato al pulsante
vb Sub PerGestionale()
Dim i As Integer
Dim ur As Integer
Dim rng As Range
Dim cel As Range
Set rng = Sheets("Preventivi").Range("A5:a20")
Sheets("Gestionale").Range("a5:K20").ClearContents
For Each cel In rng
ur = Sheets("Gestionale").Range("a3").End(xlDown).Row
If cel.Value <> "" Then
For i = 1 To 11
Sheets("Gestionale").Cells(ur + 1, i).Value = cel.Offset(0, i - 1).Value
Next i
End If
Next cel
Sheets("Gestionale").Range("F21").Value = Sheets("Preventivi").Range("F21").Value
Sheets("Gestionale").Range("B23").Value = Sheets("Preventivi").Range("B23").Value
Sheets("Gestionale").Range("D23").Value = Sheets("Preventivi").Range("D23").Value
Sheets("Gestionale").Range("K23").Value = Sheets("Preventivi").Range("K23").Value
End Sub
Fai sapere era ciò quello che volevi.
by sal, 21/06/2018 16.15:
Ciao Alfredo credo che vorrebbe i dati come il foglio Articoli perche è quello che viene passato al suo gestionale, non un nuovo foglio preventivo.
Ciao By Sal
esatto Sal! è proprio cosi
alfrimpa, come dice Sal mi occorre un foglio "articoli". comunque penso che il concetto sia giusto al di la del foglio sbagliato.
Se posso chiedertelo, riesci a rifarlo col foglio giusto? Io purtroppo non ci riuscirei...
grazie a tutti
|
| | Post: 3.792 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
21/06/2018 17:29 | |
Allora dal tuo foglio Articoli cancella tutte le formule (tranne l'intestazione) e usa questa macro
vb Sub PerGestionale()
Dim i As Integer
Dim ur As Integer
Dim tbl As Range
Dim rng As Range
Dim cel As Range
Set rng = Sheets("Preventivi").Range("A5:a20")
Set tbl = Sheets("Database").Range("E3:j1000")
Sheets("Articoli").Range("a2:D1000").ClearContents
For Each cel In rng
ur = Sheets("Articoli").Cells(Rows.Count, 1).End(xlUp).Row
If cel.Value <> "" Then
Sheets("Articoli").Cells(ur + 1, 1).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 6)
Sheets("Articoli").Cells(ur + 1, 2).Value = cel.Value
Sheets("Articoli").Cells(ur + 1, 3).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 4)
Sheets("Articoli").Cells(ur + 1, 4).Value = cel.Offset(0, 3).Value
End If
Next cel
End Sub
Fai sapere.
Alfredo |
| | Post: 3 | Registrato il: 17/11/2017
| Città: MILANO | Età: 38 | Utente Junior | 2016 | | OFFLINE | |
|
21/06/2018 18:02 | |
alfrimpa, 21/06/2018 17.29:
Allora dal tuo foglio Articoli cancella tutte le formule (tranne l'intestazione) e usa questa macro
vb Sub PerGestionale()
Dim i As Integer
Dim ur As Integer
Dim tbl As Range
Dim rng As Range
Dim cel As Range
Set rng = Sheets("Preventivi").Range("A5:a20")
Set tbl = Sheets("Database").Range("E3:j1000")
Sheets("Articoli").Range("a2:D1000").ClearContents
For Each cel In rng
ur = Sheets("Articoli").Cells(Rows.Count, 1).End(xlUp).Row
If cel.Value <> "" Then
Sheets("Articoli").Cells(ur + 1, 1).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 6)
Sheets("Articoli").Cells(ur + 1, 2).Value = cel.Value
Sheets("Articoli").Cells(ur + 1, 3).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 4)
Sheets("Articoli").Cells(ur + 1, 4).Value = cel.Offset(0, 3).Value
End If
Next cel
End Sub
Fai sapere.
SIII! funziona! ultimissima cosa solo:
ora dopo aver premuto il pulsante macro, nella scheda "articoli" colonna descrizione vedi "ALVEOLARE Sp. 6" mi occorre che CONCATENI in modo che esca"ALVEOLARE Sp. 6 50x500mm 1PZ" ovvero prenda da "preventivi" colonna B C e D. Prima lo facevo appunto con la formula CONCATENA ma come ormai ci siamo capiti il gestionale "sente" le formule.
E' possibile risolvere questa ultima difficoltà?
Comunque grazie grazie e grazie ancora!
|
| | Post: 3.793 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
21/06/2018 18:09 | |
Non so se ho capito bene; prova con questa
vb Sub PerGestionale()
Dim i As Integer
Dim ur As Integer
Dim tbl As Range
Dim rng As Range
Dim cel As Range
Set rng = Sheets("Preventivi").Range("A5:a20")
Set tbl = Sheets("Database").Range("E3:j1000")
Sheets("Articoli").Range("a2:D1000").ClearContents
For Each cel In rng
ur = Sheets("Articoli").Cells(Rows.Count, 1).End(xlUp).Row
If cel.Value <> "" Then
Sheets("Articoli").Cells(ur + 1, 1).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 6)
Sheets("Articoli").Cells(ur + 1, 2).Value = cel.Value & " " & cel.Offset(0, 1) & " " & "mm" & " " & cel.Offset(0, 2) & " " & "mm" & " " & cel.Offset(0, 3)
Sheets("Articoli").Cells(ur + 1, 3).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 4)
Sheets("Articoli").Cells(ur + 1, 4).Value = cel.Offset(0, 3).Value
End If
Next cel
End Sub
Alfredo |
| | Post: 4 | Registrato il: 17/11/2017
| Città: MILANO | Età: 38 | Utente Junior | 2016 | | OFFLINE | |
|
21/06/2018 18:54 | |
alfrimpa, 21/06/2018 18.09:
Non so se ho capito bene; prova con questa
vb Sub PerGestionale()
Dim i As Integer
Dim ur As Integer
Dim tbl As Range
Dim rng As Range
Dim cel As Range
Set rng = Sheets("Preventivi").Range("A5:a20")
Set tbl = Sheets("Database").Range("E3:j1000")
Sheets("Articoli").Range("a2:D1000").ClearContents
For Each cel In rng
ur = Sheets("Articoli").Cells(Rows.Count, 1).End(xlUp).Row
If cel.Value <> "" Then
Sheets("Articoli").Cells(ur + 1, 1).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 6)
Sheets("Articoli").Cells(ur + 1, 2).Value = cel.Value & " " & cel.Offset(0, 1) & " " & "mm" & " " & cel.Offset(0, 2) & " " & "mm" & " " & cel.Offset(0, 3)
Sheets("Articoli").Cells(ur + 1, 3).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 4)
Sheets("Articoli").Cells(ur + 1, 4).Value = cel.Offset(0, 3).Value
End If
Next cel
End Sub
hai compreso perfettamente.
mi vergogno un po ma nel frattempo mi sono accorto di un errore:
la colonna D di "articoli" non deve riportare il numero dei pezzi ma la colonna E o F del foglio "preventivi" ovvero il totale MQ o KG a seconda del tipo di materiale: ad esempio "alveolare sp.6 500x500" che va in MQ deve riportare nella colonna D di "articoli" 0.25 mentre "policarbonato sp.10" va in KG deve riportare nella colonna D sempre di "preventivi 3.13 per maggiore chiarezza nel file che qui allego ho evidenziato i valori che vanno riportati.
grazie come sempre
|
| | Post: 3.796 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
22/06/2018 14:49 | |
Ciao Maelstrom85
Ancora non so se ho capito bene; prova questa macro e fai sapere.
vb Sub PerGestionale()
Dim i As Integer
Dim ur As Integer
Dim tot As String
Dim tbl As Range
Dim rng As Range
Dim cel As Range
Set rng = Sheets("Preventivi").Range("A5:a26")
Set tbl = Sheets("Database").Range("E3:j1000")
Sheets("Articoli").Range("a2:D1000").ClearContents
For Each cel In rng
ur = Sheets("Articoli").Cells(Rows.Count, 1).End(xlUp).Row
If cel.Value <> "" Then
If cel.Offset(0, 4).Value <> "" Then
tot = cel.Offset(0, 4).Value & " Kg."
Else
tot = cel.Offset(0, 5).Value & " Mq"
End If
Sheets("Articoli").Cells(ur + 1, 1).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 6)
Sheets("Articoli").Cells(ur + 1, 2).Value = cel.Value & " " & cel.Offset(0, 1) & " " & "mm" & " " & cel.Offset(0, 2) & " " & "mm" & " " & tot
Sheets("Articoli").Cells(ur + 1, 3).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 4)
Sheets("Articoli").Cells(ur + 1, 4).Value = cel.Offset(0, 3).Value
End If
Next cel
End Sub
Nel caso vi fossero ancora discrepanze scrivi l'esatta descrizione che deve comparire in colonna B del foglio "Articoli".
Alfredo |
| | Post: 5 | Registrato il: 17/11/2017
| Città: MILANO | Età: 38 | Utente Junior | 2016 | | OFFLINE | |
|
22/06/2018 16:17 | |
alfrimpa, 22/06/2018 14.49:
Ciao Maelstrom85
Ancora non so se ho capito bene; prova questa macro e fai sapere.
vb Sub PerGestionale()
Dim i As Integer
Dim ur As Integer
Dim tot As String
Dim tbl As Range
Dim rng As Range
Dim cel As Range
Set rng = Sheets("Preventivi").Range("A5:a26")
Set tbl = Sheets("Database").Range("E3:j1000")
Sheets("Articoli").Range("a2:D1000").ClearContents
For Each cel In rng
ur = Sheets("Articoli").Cells(Rows.Count, 1).End(xlUp).Row
If cel.Value <> "" Then
If cel.Offset(0, 4).Value <> "" Then
tot = cel.Offset(0, 4).Value & " Kg."
Else
tot = cel.Offset(0, 5).Value & " Mq"
End If
Sheets("Articoli").Cells(ur + 1, 1).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 6)
Sheets("Articoli").Cells(ur + 1, 2).Value = cel.Value & " " & cel.Offset(0, 1) & " " & "mm" & " " & cel.Offset(0, 2) & " " & "mm" & " " & tot
Sheets("Articoli").Cells(ur + 1, 3).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 4)
Sheets("Articoli").Cells(ur + 1, 4).Value = cel.Offset(0, 3).Value
End If
Next cel
End Sub
Nel caso vi fossero ancora discrepanze scrivi l'esatta descrizione che deve comparire in colonna B del foglio "Articoli".
come sempre ringrazio,
in pratica nella colonna B di "articoli" deve comparire
Alveolare sp.6x500x500mm 1pz
nella colonna D di articoli deve comparire 0.25 (per capirci il totale di "preventiviF5" visto che quel materiale va in MQ; oppure preventiviE5 se il materiale va in KG)
allego una foto editata con Paint per vedere come dovrebbe diventare.
[Modificato da maelstrom85 22/06/2018 16:30] |
| | Post: 3.804 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
26/06/2018 12:10 | |
Ciao maelstrom85
Riallega un file di Excel compilando il foglio "Preventivi" e sulla base di questo mostra come deve essere compilato (correttamente il foglio "Articoli"
Intanto provo a far qualcosa sulla base di quello che ho. [Modificato da alfrimpa 26/06/2018 12:13]
Alfredo |
| | Post: 3.805 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Master | Excel 365 | | OFFLINE |
|
26/06/2018 15:12 | |
Ciao maelstrom85
Questa macro dovrebbe funzionare ma solo per quelli articoli che hanno nel databaae come U.M mq
vb
Sub PerGestionale()
Dim i As Integer
Dim ur As Integer
Dim tbl As Range
Dim rng As Range
Dim cel As Range
Set rng = Sheets("Preventivi").Range("A5:a20")
Set tbl = Sheets("Database").Range("E3:j1000")
Sheets("Articoli").Range("a2:D1000").ClearContents
For Each cel In rng
ur = Sheets("Articoli").Cells(Rows.Count, 1).End(xlUp).Row
If cel.Value <> "" Then
Sheets("Articoli").Cells(ur + 1, 1).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 6)
Sheets("Articoli").Cells(ur + 1, 2).Value = cel.Value & " " & cel.Offset(0, 1) & " " & "mm" & " " & cel.Offset(0, 2) & " " & "mm" & " " & cel.Offset(0, 3) & " pz"
Sheets("Articoli").Cells(ur + 1, 3).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 4)
Sheets("Articoli").Cells(ur + 1, 4).Value = cel.Offset(0, 5).Value
End If
Next cel
End Sub
Per gli altri dovresti vedere un po' tu e dire cosa c'è che non va e darmi istruzioni su come gestire invari casi dell’U.M. [Modificato da alfrimpa 26/06/2018 17:22]
Alfredo |
| | Post: 6 | Registrato il: 17/11/2017
| Città: MILANO | Età: 38 | Utente Junior | 2016 | | OFFLINE | |
|
27/06/2018 12:13 | |
alfrimpa, 26/06/2018 15.12:
Ciao maelstrom85
Questa macro dovrebbe funzionare ma solo per quelli articoli che hanno nel databaae come U.M mq
vb
Sub PerGestionale()
Dim i As Integer
Dim ur As Integer
Dim tbl As Range
Dim rng As Range
Dim cel As Range
Set rng = Sheets("Preventivi").Range("A5:a20")
Set tbl = Sheets("Database").Range("E3:j1000")
Sheets("Articoli").Range("a2:D1000").ClearContents
For Each cel In rng
ur = Sheets("Articoli").Cells(Rows.Count, 1).End(xlUp).Row
If cel.Value <> "" Then
Sheets("Articoli").Cells(ur + 1, 1).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 6)
Sheets("Articoli").Cells(ur + 1, 2).Value = cel.Value & " " & cel.Offset(0, 1) & " " & "mm" & " " & cel.Offset(0, 2) & " " & "mm" & " " & cel.Offset(0, 3) & " pz"
Sheets("Articoli").Cells(ur + 1, 3).Value = Application.WorksheetFunction.VLookup(cel.Value, tbl, 4)
Sheets("Articoli").Cells(ur + 1, 4).Value = cel.Offset(0, 5).Value
End If
Next cel
End Sub
Per gli altri dovresti vedere un po' tu e dire cosa c'è che non va e darmi istruzioni su come gestire invari casi dell’U.M.
ciao,
ho utilizzato questa ultima macro, e, ho adattato il file excel in modo artificioso in modo che funzionasse come volevo io.
Il risultato quindi è che sono soddisfatto, ho provato a caricare il file su gestionale e tutto funziona
Ringrazio sentitamente per il tempo a me dedicato e per la pazienza!!
saluti
|
|
|