Buongiorno,
inserisco un codice che ho cercato di fare funzionare:
Premessa riesco ad estrarre delle righe in funzione a delle condizioni,vorrei inserire per tutte le pagine estratte delle righe con : codice, denominazione e corsoes: codice:rcsp010006
denominazione:righi
corso: aspp
praticamente ho 36 scuole con dei corsisti, ogni scuola inserisce in db dei nomi , dovrei estrarre per ogni scuola i corsisti per corso.
------------
Public estrai As String
Function WorksheetExists(WSName As String) As Boolean
' la funzione controlla l'esistenza del foglio denominato WSName
On Error Resume Next
WorksheetExists = Len(Worksheets(WSName).Name) > 0
End Function
Sub Compila()
'Sheets("Foglio3").Cells.Clear
Dim wrkPagina As Worksheet
Dim CODICE As String
CODICE = UCase(estrai)
If WorksheetExists(CODICE) = True Then
' se il foglio esiste --> cancello tutti i dati
Sheets(CODICE).Cells.Clear
Else
' se il foglio non esiste --> creo un nuovo foglio di lavoro
Set wrkPagina = ActiveWorkbook.Worksheets.Add()
wrkPagina.Name = CODICE
End If
Sheets("Foglio1").Activate
Rows(4).Copy Destination:=Sheets(CODICE).Cells(1, 1)
For RC = 3 To 550
If Range("B" & RC).Value = UCase(estrai) Then
If Range("N" & RC).Value >= 0 Then
Rows(RC & ":" & RC).Copy Destination:=Sheets(CODICE).Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End If
End If
Next
MsgBox " LA SCUOLA SI TROVA SUL FOGLIO " & CODICE & "! "
End Sub
Sub Avvio()
UserForm1.Show
End Sub
-----------------
Grazie biagio, se non sono stato chiaro ditemi come posso inviare un file di esempio