sintassi:
Dim variabile dichiaro la variabile
For Each variabile In gruppo inizia ciclo per ciascuna cosa dentro al gruppo
... istruzioniNext variabile fine ciclo
gruppi
....Next cella
....Next cella
....Next elemento
....Next elemento
If scheda.Name = "NOMESCHEDA" Then ....Next scheda
If scheda.Name = "NOMESCHEDA" Then ....Next scheda
esempio: arrey dei nomi delle schede selezionate
Dim scheda As Object
Dim schedesel()
quanteschede = Application.ActiveWindow.SelectedSheets.Count quantità di schede selezionate
x = 0 variabile posizione array
ReDim schedesel(quanteschede) ridimensiono arry in base al numero di schede
For Each scheda In ActiveWindow.SelectedSheets ciclo assegna valore agli elementi dell'array
schedesel(x) = scheda.NameNext scheda
x = x + 1
If wb.Name = "XXX.xls" Then wb.ActivateNext wb
creo un filtro automatco in una tabella pivot tramite un cicloNext filtro
If filtro = "xxx" Or filtro = "yyy" Thenfiltro.Visible = TrueElsefiltro.Visible = FalseEnd If
If tabella.Name ... ThenNext tabella...End If
shp.metodoNext shp