| | Post: 44 | Registrato il: 12/04/2013
| Città: BARI | Età: 34 | Utente Junior | 2016 | | OFFLINE | |
|
13/02/2017 15:34 | |
Ciao ragazzi, come posso fare per far sì che una certa macro che viene eseguita all'apertura del file, venga eseguita su tutti i fogli tranne uno specifico?
Ho questo codice in Questa_Cartella:
Private Sub Workbook_Open()
If Month(ThisWorkbook.Sheets("Foglio1").Range("A1")) <> Month(Now) Then
Call Macro2
End If
End Sub
Grazie |
|
| | Post: 3.699 | Registrato il: 13/03/2012
| Città: LIVORNO | Età: 78 | Utente Master | 2010 | | OFFLINE | |
|
13/02/2017 16:55 | |
Private Sub Workbook_Open()
for each sh in sheets
if sh.name <> "foglio da escludere" then
If Month(Sh.Range("A1")) <> Month(Now) Then
Call Macro2
End If
end if
next
End Sub
----------
Win 10 - Excel 2010
allega un file di esempio, guadagnerai tempo tu e lo farai risparmiare a chi ti aiuta |
| | Post: 44 | Registrato il: 12/04/2013
| Città: BARI | Età: 34 | Utente Junior | 2016 | | OFFLINE | |
|
13/02/2017 17:36 | |
Ciao, ho inserito il tuo codice, però all'apertura del file, mi dice : Tipo non corrispondente e mi da errore sulla riga: If Month etc...
Grazie per l'aiuto |
| | Post: 2.764 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Veteran | Excel 365 | | OFFLINE |
|
13/02/2017 17:58 | |
Prova a scrivere
If CDate(Month.....
Alfredo |
| | Post: 45 | Registrato il: 12/04/2013
| Città: BARI | Età: 34 | Utente Junior | 2016 | | OFFLINE | |
|
13/02/2017 20:31 | |
purtroppo neanche così funziona..
Adesso la macro si attiva solo sul foglio in cui l'ho registrata.
Vi allego il file, Grazie per l'aiuto
https://www.dropbox.com/s/9r59he2gb62ovv2/FINALE.xlsm?dl=0 |
| | Post: 3.700 | Registrato il: 13/03/2012
| Città: LIVORNO | Età: 78 | Utente Master | 2010 | | OFFLINE | |
|
13/02/2017 20:36 | |
hai fatto delle modifiche al codice che ti ho suggerito, perché non lo copi aggiungendo soltanto la call ?
----------
Win 10 - Excel 2010
allega un file di esempio, guadagnerai tempo tu e lo farai risparmiare a chi ti aiuta |
| | Post: 46 | Registrato il: 12/04/2013
| Città: BARI | Età: 34 | Utente Junior | 2016 | | OFFLINE | |
|
13/02/2017 20:38 | |
Sisi, potrai notare che ho inserito il tuo suggerimento |
| | Post: 47 | Registrato il: 12/04/2013
| Città: BARI | Età: 34 | Utente Junior | 2016 | | OFFLINE | |
|
14/02/2017 17:59 | |
Patel45 nel file che ho linkato, la tua soluzione non è inserita in quanto ho problemi nella riga If Month...l'errore è Tipo non corrispondente (anche applicando il suggerimento di Fratimpa)
Come posso risolvere secondo voi? |
| | Post: 48 | Registrato il: 12/04/2013
| Città: BARI | Età: 34 | Utente Junior | 2016 | | OFFLINE | |
|
14/02/2017 21:01 | |
Vi allego il file ultimato, rimane solo da far partire la macro su tutti i fogli (tranne "IMPIANTI") e non solo su quello in cui l'ho registrata
Grazie
https://www.dropbox.com/s/19fqsz92r1okbfp/FINAE.xlsm?dl=0 |
| | Post: 50 | Registrato il: 12/04/2013
| Città: BARI | Età: 34 | Utente Junior | 2016 | | OFFLINE | |
|
14/02/2017 23:31 | |
Ragazzi, finalmente ci sono riuscitoooo!
Praticamente, mi ostinavo a inserire il For in Questa_Cartella di lavoro, invece, lo dovevo inserire nella Macro!
Adesso funziona.
L'unica cosa, come posso fare far si che alla fine, si ritorni al primo foglio e non che resti all'ultimo?
In Questa_Cartella ho inserito : Worksheets.("IMPIANTI").Select, però non funziona |
| | Post: 119 | Registrato il: 21/03/2014
| Città: MILANO | Età: 36 | Utente Junior | 2007 | | OFFLINE | |
|
14/02/2017 23:53 | |
Ciao prova con: Sheets("IMPIANTI").Select |
|
|