| | Post: 1 | Registrato il: 14/08/2017
| Città: SAN FILIPPO DEL MELA | Età: 39 | Utente Junior | EXCEL 2019 | | OFFLINE | |
|
09/04/2021 09:09 | |
Salve a tutti, chiedevo un aiuto per poter semplificare con qualche macro i tanti passaggi fatti con formule.
Ogni fine mese, dovrei copiare la data del mese e la somma totale dei valori in un altro foglio.
ho provato a registrare la macro, è proprio necessario che nel copiare i dati mi apre e chiude il foglio(ARCHIVIO)?
GRAZIE IN ANTICIPO. |
|
| | Post: 904 | Registrato il: 24/06/2015
| Città: CATANIA | Età: 80 | Utente Senior | Excel2019 | | OFFLINE |
|
09/04/2021 09:20 | |
Ciao
Premesso che nel tuo file non c'è alcuna macro, mi sembra ovvio che - se non fai nulla in tal senso - ti visualizzi il Foglio dove scrivere i dati.
Prova a mettere all'inizio della macro
Application.ScreenUpDating = False
e prima di End Sub
Application.ScreenUpDating = True
Ti evita l' "apertura/chiusura" (ma sarebbe meglio dire "visualizzazione") del Foglio Archivio.
Ciao,
Mario |
| | Post: 3.132 | Registrato il: 06/04/2013
| Utente Master | 2010 | | OFFLINE |
|
09/04/2021 10:14 | |
Ciao
Sub copia()
Dim wkFrom As Worksheet, wkTo As Worksheet, mRng As Range, mDest As Range
Set wkFrom = Worksheets("Foglio2")
Set wkTo = Worksheets("ARCHIVIO")
Set mRng = wkFrom.Range("AH8:AH31")
Set mDest = wkTo.Range("F4:F27")
mDest.Value = mRng.Value
End Sub
saluti
Domenico
Win 10 - Excel 2016 |
| | Post: 1 | Registrato il: 14/08/2017
| Città: SAN FILIPPO DEL MELA | Età: 39 | Utente Junior | EXCEL 2019 | | OFFLINE | |
|
09/04/2021 11:48 | |
ok scusate i termini... copia ok, però ogni volta che premo il pulsante, deve copiare nella colonna successiva in archivio, e aggiornare mese successivo in c5(foglio2).
adesso provo a fare qualche prova e poi posto. anche perchè devo poi aggiungere messaggi.... vado ad un passo alla volta.
grazie |
| | Post: 2 | Registrato il: 14/08/2017
| Città: SAN FILIPPO DEL MELA | Età: 39 | Utente Junior | EXCEL 2019 | | OFFLINE | |
|
09/04/2021 15:40 | |
ciao dodo47 ho inserito la formula, è quasi perfetta, ora allego il file. però dopo aver copiato i valori, deve copiare la data foglio2 C5 in archivio G3, e successivamente dovrebbe andare al mese successivo. |
| | Post: 3.134 | Registrato il: 06/04/2013
| Utente Master | 2010 | | OFFLINE |
|
09/04/2021 16:23 | |
specifica che vuol dire "..... e successivamente dovrebbe andare al mese successivo....."
dettagliando bene
saluti
[Modificato da dodo47 09/04/2021 16:25] Domenico
Win 10 - Excel 2016 |
| | Post: 3 | Registrato il: 14/08/2017
| Città: SAN FILIPPO DEL MELA | Età: 39 | Utente Junior | EXCEL 2019 | | OFFLINE | |
|
09/04/2021 16:41 | |
praticamente sono dati che vengono aggiornati mensilmente, ogni fine mese stampa, copia i dati in archivio, cancella la tabella, e inizio x il mese successivo. aprile 21 - maggio 21 - giugno 21.... ecc.
grazie per la pazienza. |
| | Post: 3.135 | Registrato il: 06/04/2013
| Utente Master | 2010 | | OFFLINE |
|
09/04/2021 17:44 | |
ma le date nel foglio Archivio già esistono ???
saluti
Domenico
Win 10 - Excel 2016 |
| | Post: 4 | Registrato il: 14/08/2017
| Città: SAN FILIPPO DEL MELA | Età: 39 | Utente Junior | EXCEL 2019 | | OFFLINE | |
|
12/04/2021 14:23 | |
Ciao, scusami per il ritardo, no no le date non esistono. li deve copiare dal foglio di lavorazione.
In pratica a fine mese dovrei stampare la tabella, la somma totale la dovrebbe copiare in archivio insieme al mese corrente.
questa operazione viene fatta mensilmente.
poi da qui con devo estrarre una serie di valori che potrebbero andare bene anche le formule.
grazie |
| | Post: 3.137 | Registrato il: 06/04/2013
| Utente Master | 2010 | | OFFLINE |
|
12/04/2021 16:47 | |
Ciao
Sub copia()
Dim wkFrom As Worksheet, wkTo As Worksheet, mRng, mDest As String, ColArc As Integer
Set wkFrom = Worksheets("Foglio2")
Set wkTo = Worksheets("ARCHIVIO")
mRng = wkFrom.Range("AH8:AH31")
mdata = wkFrom.Range("C5").Value
ColArc = wkTo.Cells(3, Columns.Count).End(xlToLeft).Column + 1
If ColArc = 2 Then ColArc = 3
With wkTo.Range("3:3")
Set c = .Find(what:=mdata, LookIn:=xlFormulas, lookat:=xlWhole)
If Not c Is Nothing Then
domanda = MsgBox("data già esistente in Arvìchivio. Sovrascrivere ?", vbYesNo)
If domanda = vbNo Then GoTo esci
ColArc = c.Column
End If
If Not domanda = vbYes Then
domanda = MsgBox("Copiare valori del " & mdata & " ?", vbYesNo)
If domanda = vbNo Then GoTo esci
End If
wkTo.Cells(3, ColArc) = mdata
wkTo.Cells(4, ColArc).Resize(UBound(mRng), 1) = mRng
End With
MsgBox "copiato"
esci:
Set wkFrom = Nothing
Set wkTo = Nothing
Set mRng = Nothing
End Sub
Saluti
Domenico
Win 10 - Excel 2016 |
| | Post: 5 | Registrato il: 14/08/2017
| Città: SAN FILIPPO DEL MELA | Età: 39 | Utente Junior | EXCEL 2019 | | OFFLINE | |
|
13/04/2021 17:16 | |
ciao dodo47, SPETTACOLARE.... sei un genio 😄😄 la formula è perfetta.
un ultima cosa, dopo aver copiato i valori, nel foglio2 c5 la data potrebbe andare al mese successivo?
grazie mille..... |
| | Post: 3.140 | Registrato il: 06/04/2013
| Utente Master | 2010 | | OFFLINE |
|
13/04/2021 19:06 | |
ciao
basta che vari H3 nel foglio2.....un po' di iniziativa anche da parte tua non guasterebbe.
saluti
Domenico
Win 10 - Excel 2016 |
| | Post: 6 | Registrato il: 14/08/2017
| Città: SAN FILIPPO DEL MELA | Età: 39 | Utente Junior | EXCEL 2019 | | OFFLINE | |
|
14/04/2021 09:28 | |
ciao era per togliere le prime 3 righe dal foglio... va bene lo stesso.... grazie infinite |
|
|