Pagina precedente | 1 | Pagina successiva
Vota | Stampa | Notifica email    
Autore

copia da un foglio incolla in tutti gli altri fogli

Ultimo Aggiornamento: 19/02/2021 16:43
Post: 5
Registrato il: 27/01/2020
Età: 65
Utente Junior
2013
OFFLINE
18/02/2021 09:51

copia da un foglio incolla in tutti gli altri fogli
buongiorno a tutti un piccolo aiuto con questa macro sto cercando di copiare i dati da un foglio e incollarli in tutti i fogli della cartella ma mi da errore dove sbaglio, grazie in anticipo



Sheets("fascia").Select
For Each c In [A5:AK28,A35:AK58]
If c <> "" Then
c.Copy

For Each xWs In Application.ActiveWorkbook.Worksheets
If xWs.Name <> "Calendario" And xWs.Name <> "fascia" Then
xWs.Range("D6:AK29").Paste
xWs.Range("D36:AK59").Paste
xWs.Range("D66:AK89").Paste
xWs.Range("D96:AK119").Paste
xWs.Range("D126:AK149").Paste
xWs.Range("D156:AK180").Paste
xWs.Range("D186:AK209").Paste
xWs.Range("D216:AK239").Paste
xWs.Range("D246:AK269").Paste
xWs.Range("D276:AK299").Paste
xWs.Range("D306:AK329").Paste
xWs.Range("D336:AK359").Paste
End If
End If
Next
Next

End Sub
Post: 4.586
Registrato il: 21/06/2013
Città: NAPOLI
Età: 70
Utente Master
Excel 365
OFFLINE
18/02/2021 12:23

Allega un file di esempio con dati e risultato voluto messo a mano.

Alfredo
Post: 5
Registrato il: 27/01/2020
Età: 65
Utente Junior
2013
OFFLINE
18/02/2021 13:14

ecco il file grazie
http://www.filedropper.com/prova_11
[Modificato da peppe(59) 18/02/2021 13:18]
Post: 4.588
Registrato il: 21/06/2013
Città: NAPOLI
Età: 70
Utente Master
Excel 365
OFFLINE
18/02/2021 13:28

Tu hai scritto "copiare da foglio facia D5:AK28" ma non mi pare che esista un fogli facia.

Avevo chiesto di vedere un esempio concreto (con i dati) del risultato che vuoi ottenere; tale esempio, nel file allegato non c'è.

Alfredo
Post: 6
Registrato il: 27/01/2020
Età: 65
Utente Junior
2013
OFFLINE
18/02/2021 13:33

ciao fascia è il foglio dove ci sta la spiegazione sono questi da copiare [A5:AK28,A35:AK58]
[Modificato da peppe(59) 18/02/2021 13:34]
Post: 7
Registrato il: 27/01/2020
Età: 65
Utente Junior
2013
OFFLINE
18/02/2021 13:37

scusa errore di scrittura
Post: 8
Registrato il: 27/01/2020
Età: 65
Utente Junior
2013
OFFLINE
18/02/2021 13:42

se vai nel foglio gennaio ci sta un pulsante aggiorna da li vedi l'errore che mi da, dice end if senza if se metto end if dopo il primo for mi dice proprietà o metodo non supportato dall' oggetto
[Modificato da peppe(59) 18/02/2021 13:47]
Post: 4.589
Registrato il: 21/06/2013
Città: NAPOLI
Età: 70
Utente Master
Excel 365
OFFLINE
18/02/2021 15:52

Assodato che il tuo codice non funziona per poter rispondere ho bisogno di vedere materialmente il risultato che ti aspetti dalla macro inserito a mano nel file.

Alfredo
Post: 9
Registrato il: 27/01/2020
Età: 65
Utente Junior
2013
OFFLINE
18/02/2021 16:10

anfrima scusami sinceramente non capisco che vuoi dire il risultato è che mi aspetto è quello che ti ho scritto
Post: 1.093
Registrato il: 16/08/2015
Città: CORDENONS
Età: 67
Utente Veteran
Excel 2016-32bit Win11
OFFLINE
18/02/2021 16:39

Un saluto a tutti.
Nella macro Private Sub aggiorna() semplicemente hai un accavallamento alternato nella chiusura degli If/End If e i For/Next.

______________________________________________________________
C'è chi fa le COSE a CASO e chi fa CASO alle COSE (Ignoto)
Post: 10
Registrato il: 27/01/2020
Età: 65
Utente Junior
2013
OFFLINE
18/02/2021 17:39

ciao rollis potresti aiutarmi a risolvere ci sto impazzendo
Post: 1.094
Registrato il: 16/08/2015
Città: CORDENONS
Età: 67
Utente Veteran
Excel 2016-32bit Win11
OFFLINE
18/02/2021 17:46

For Each c
    If c
        For Each xWs
            If xWs.Name

            End If
        Next xWs
    End If
Next c
[Modificato da rollis13 18/02/2021 17:49]

______________________________________________________________
C'è chi fa le COSE a CASO e chi fa CASO alle COSE (Ignoto)
Post: 11
Registrato il: 27/01/2020
Età: 65
Utente Junior
2013
OFFLINE
18/02/2021 18:02

[Modificato da peppe(59) 18/02/2021 18:05]
Post: 12
Registrato il: 27/01/2020
Età: 65
Utente Junior
2013
OFFLINE
18/02/2021 18:03






Sheets("fascia").Select
For Each c In [A5:AK28,A35:AK58]
If c <> "" Then
c.Copy

For Each xWs In Application.ActiveWorkbook.Worksheets
If xWs.Name <> "Calendario" And xWs.Name <> "fascia" Then
xWs.Range("D6:AK29").Paste
xWs.Range("D36:AK59").Paste
xWs.Range("D66:AK89").Paste
xWs.Range("D96:AK119").Paste
xWs.Range("D126:AK149").Paste
xWs.Range("D156:AK180").Paste
xWs.Range("D186:AK209").Paste
xWs.Range("D216:AK239").Paste
xWs.Range("D246:AK269").Paste
xWs.Range("D276:AK299").Paste
xWs.Range("D306:AK329").Paste
xWs.Range("D336:AK359").Paste
End If
Next xWs
End If
Next c




mi da sempre errore
[Modificato da peppe(59) 18/02/2021 18:07]
Post: 13
Registrato il: 27/01/2020
Età: 65
Utente Junior
2013
OFFLINE
18/02/2021 18:49

qualcuno mi può aiutare perchè mi da questo errore run time 438 proprietà o metodo non supportati dall 'oggetto
[Modificato da peppe(59) 18/02/2021 18:51]
Post: 1.095
Registrato il: 16/08/2015
Città: CORDENONS
Età: 67
Utente Veteran
Excel 2016-32bit Win11
OFFLINE
18/02/2021 23:36

Ma è tutta sgangherata la tua macro, non era solo un problema di accavallamenti. Prova con questa che sicuramente andrà un po' meglio. Lascio a te aggiustarla al meglio se serve.
Private Sub aggiorna()
    Dim rng1   As Range
    Dim rng2   As Range
    Dim xWs    As Worksheet
    Application.ScreenUpdating = False
    Sheets("fascia").Select
    Set rng1 = Range("D5:AK28")
    Set rng2 = Range("D35:AK58")
    For Each xWs In Application.ActiveWorkbook.Worksheets
        If xWs.Name <> "Calendario" And xWs.Name <> "fascia" Then
            xWs.Select
            rng1.Copy xWs.Range("D6")
            rng2.Copy xWs.Range("D36")
            rng1.Copy xWs.Range("D66")
            rng2.Copy xWs.Range("D96")
            rng1.Copy xWs.Range("D126")
            rng2.Copy xWs.Range("D156")
            rng1.Copy xWs.Range("D186")
            rng2.Copy xWs.Range("D216")
            rng1.Copy xWs.Range("D246")
            rng2.Copy xWs.Range("D276")
            rng1.Copy xWs.Range("D306")
            rng2.Copy xWs.Range("D336")
        End If
    Next xWs
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub
[Modificato da rollis13 18/02/2021 23:44]

______________________________________________________________
C'è chi fa le COSE a CASO e chi fa CASO alle COSE (Ignoto)
Post: 14
Registrato il: 27/01/2020
Età: 65
Utente Junior
2013
OFFLINE
19/02/2021 00:09

grazie mille
Post: 1.096
Registrato il: 16/08/2015
Città: CORDENONS
Età: 67
Utente Veteran
Excel 2016-32bit Win11
OFFLINE
19/02/2021 16:43

Grazie del riscontro positivo 👍.

______________________________________________________________
C'è chi fa le COSE a CASO e chi fa CASO alle COSE (Ignoto)
Vota:
Amministra Discussione: | Chiudi | Sposta | Cancella | Modifica | Notifica email Pagina precedente | 1 | Pagina successiva
Nuova Discussione
 | 
Rispondi
Feed | Forum | Bacheca | Album | Utenti | Cerca | Login | Registrati | Amministra
Tutti gli orari sono GMT+01:00. Adesso sono le 12:05. Versione: Stampabile | Mobile | Regolamento | Privacy
FreeForumZone [v.6.1] - Copyright © 2000-2024 FFZ srl - www.freeforumzone.com