Condividi:        

[Excel] Tabelle per Statistiche Calcio

Vuoi potenziare i tuoi documenti Word? Non sai come si fa una macro in Excel? Devi creare una presentazione in PowerPoint?
Oppure sei passato a OpenOffice e non sei sicuro di come lavorare al meglio?

Moderatori: Anthony47, Flash30005

[Excel] Tabelle per Statistiche Calcio

Postdi dome10 » 05/03/15 15:43

Salve ragazzi, sto creando un file di statistiche calcio, importo le tabelle totale, home, away per ogni singolo campionato in unico foglio, problema è che vorrei copiare nel foglio "totale" tutte le tabelle totali dei vari campionati, nel foglio "home" tutte le tabelle home, nel foglio "away" tutte le tabelle away .Spero di essere stato chiaro
allego file.
http://www.filedropper.com/provasta
dome10
Utente Junior
 
Post: 16
Iscritto il: 05/03/15 15:04

Sponsor
 

Re: [Excel] Tabelle per Statistiche Calcio

Postdi Flash30005 » 06/03/15 03:38

Ciao Dome10 e benvenuto nel Forum

Inserisci in un modulo questa macro e avviala
Codice: Seleziona tutto
Sub TrascTab()
Dim FC As Worksheet
Dim FH As Worksheet
Dim FA As Worksheet
Set FC = Worksheets("classifiche")
Set FH = Worksheets("home")
Set FA = Worksheets("away")
FH.Cells.Clear
FA.Cells.Clear
Application.ScreenUpdating = False
Application.Calculation = xlManual
URC = FC.Range("A" & Rows.Count).End(xlUp).Row
WS = ""
RigaI = 0
RigaF = 0
For RRC = 1 To URC
    If UCase(Left(FC.Range("A" & RRC).Value, 4)) = "HOME" Then
       Set WS = FH
        RigaI = RRC
    Else
        If UCase(Left(FC.Range("A" & RRC).Value, 4)) = "AWAY" Then
            Set WS = FA
            RigaI = RRC
        End If
    End If
    If RigaI > 0 Then
        If UCase(Left(Trim(FC.Range("A" & RRC).Value), 6)) = "LEAGUE" Then
            RigaF = RRC
            URW = WS.Range("A" & Rows.Count).End(xlUp).Row + 1
            FC.Range("A" & RigaI & ":I" & RigaF).Copy Destination:=WS.Range("A" & URW)
        RRC = RigaF
        End If
End If
Next RRC
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub


Ciao
Flash
Win10 + Office 2010 Ita
"Fotografica" al servizio dell'immagine
Avatar utente
Flash30005
Moderatore
 
Post: 8517
Iscritto il: 27/09/07 11:44
Località: Roma +o-

Re: [Excel] Tabelle per Statistiche Calcio

Postdi dome10 » 06/03/15 12:42

Ciao Flash, grazie della macro, provandola ho riscontrato dei problemi, per il foglio "totali" non copia tabella mentre nel foglio "away"mi copia sia la tabella totale e poi mi ripete due volte la tabella away.Ti allego foto(per il foglio Away ho nascosto alcune righe per farle entrare nell'immagine).Grazie
Foglio Away
Immagine
invia immagini
Foglio Totali
Immagine
upload
dome10
Utente Junior
 
Post: 16
Iscritto il: 05/03/15 15:04

Re: [Excel] Tabelle per Statistiche Calcio

Postdi Flash30005 » 06/03/15 15:26

Per la duplicazione tabella in foglio Away devi aggiungere solo il reset rigaI in questo punto
Codice: Seleziona tutto
            RRC = RigaF  '<<<<<<<<<<<<<<< esistente
            RigaI = 0        '<<<<<<<<<<<<<<< <<<< aggiungere
      End If                 '<<<<<<<<<<<<<<< esistente


per quanto riguarda il foglio totali non so cosa vorresti avere
la copia del foglio classifiche?

ciao
Flash
Win10 + Office 2010 Ita
"Fotografica" al servizio dell'immagine
Avatar utente
Flash30005
Moderatore
 
Post: 8517
Iscritto il: 27/09/07 11:44
Località: Roma +o-

Re: [Excel] Tabelle per Statistiche Calcio

Postdi dome10 » 06/03/15 19:47

Grazie Flash, nella Foglio "totali" vanno tutte le prime tabelle dei vari campionati(quelle con intestazione "Matches of...").
Ti allego immagine
Immagine
host immagini
Io ho provato, cosi ma nel Foglio "totali" non trovo niente (come vedi sono newbie con vba)
Codice: Seleziona tutto
Sub TrascTab()
    Dim FC As Worksheet
    Dim FT As Worksheet
    Dim FH As Worksheet
    Dim FA As Worksheet
    Set FC = Worksheets("classifiche")
    Set FT = Worksheets("totale")
    Set FH = Worksheets("home")
    Set FA = Worksheets("away")
    FT.Cells.Clear
    FH.Cells.Clear
    FA.Cells.Clear
    Application.ScreenUpdating = False
    Application.Calculation = xlManual
    URC = FC.Range("A" & Rows.Count).End(xlUp).Row
    WS = ""
    RigaI = 0
    RigaF = 0
    For RRC = 1 To URC
        If UCase(Left(FC.Range("A" & RRC).Value, 4)) = "MATCHES" Then
           Set WS = FT
            RigaI = RRC
        Else
         
          If UCase(Left(FC.Range("A" & RRC).Value, 4)) = "HOME" Then
           Set WS = FH
            RigaI = RRC
        Else
            If UCase(Left(FC.Range("A" & RRC).Value, 4)) = "AWAY" Then
                Set WS = FA
                RigaI = RRC
            End If
        End If
        If RigaI > 0 Then
            If UCase(Left(Trim(FC.Range("A" & RRC).Value), 6)) = "LEAGUE" Then
                RigaF = RRC
                URW = WS.Range("A" & Rows.Count).End(xlUp).Row + 1
                FC.Range("A" & RigaI & ":I" & RigaF).Copy Destination:=WS.Range("A" & URW)
              RRC = RigaF
            RigaI = 0
      End If
     
      End If
   End If
   
    Next RRC
    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True
    End Sub
dome10
Utente Junior
 
Post: 16
Iscritto il: 05/03/15 15:04

Re: [Excel] Tabelle per Statistiche Calcio

Postdi Flash30005 » 07/03/15 00:36

Forse così?

Codice: Seleziona tutto
Sub TrascTab()
Dim FC As Worksheet
Dim FH As Worksheet
Dim FA As Worksheet
Dim FT As Worksheet
Set FC = Worksheets("classifiche")
Set FH = Worksheets("home")
Set FA = Worksheets("away")
Set FT = Worksheets("totale")
FH.Cells.Clear
FA.Cells.Clear
FT.Cells.Clear
Application.ScreenUpdating = False
Application.Calculation = xlManual
URC = FC.Range("A" & Rows.Count).End(xlUp).Row
ws = ""
RigaI = 0
RigaF = 0
For RRC = 1 To URC
    If UCase(Left(FC.Range("A" & RRC).Value, 4)) = "HOME" Then
       Set ws = FH
        RigaI = RRC
    Else
        If UCase(Left(FC.Range("A" & RRC).Value, 4)) = "AWAY" Then
            Set ws = FA
            RigaI = RRC
        Else
           If UCase(Left(FC.Range("A" & RRC).Value, 4)) = "MATC" Then
           Set ws = FT
           RigaI = RRC
           End If
        End If
    End If
    If RigaI > 0 Then
        If UCase(Left(Trim(FC.Range("A" & RRC).Value), 6)) = "LEAGUE" Then
            RigaF = RRC
            URW = ws.Range("A" & Rows.Count).End(xlUp).Row + 1
            FC.Range("A" & RigaI & ":I" & RigaF).Copy Destination:=ws.Range("A" & URW)
            RRC = RigaF
            RigaI = 0
        End If
End If
Next RRC
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub


Come newbie non male
applicati un po' di più perché si tratta di capire la logica e le macro che posto sono user friendly :)

ciao
Flash
Win10 + Office 2010 Ita
"Fotografica" al servizio dell'immagine
Avatar utente
Flash30005
Moderatore
 
Post: 8517
Iscritto il: 27/09/07 11:44
Località: Roma +o-

Re: [Excel] Tabelle per Statistiche Calcio

Postdi dome10 » 07/03/15 09:58

Grazie Flash, era quello che cercavo.
dome10
Utente Junior
 
Post: 16
Iscritto il: 05/03/15 15:04


Torna a Applicazioni Office Windows


Topic correlati a "[Excel] Tabelle per Statistiche Calcio":


Chi c’è in linea

Visitano il forum: Ricky0185 e 57 ospiti