Stellar Blade Un'esclusiva PS5 che sta facendo discutere per l'eccessiva bellezza della protagonista. Vieni a parlarne su Award & Oscar!

Excel Forum Per condividere esperienze su Microsoft Excel

Indice fogli di lavoro con esclusioni

  • Messaggi
  • OFFLINE
    BG66
    Post: 218
    Registrato il: 13/12/2015
    Città: MILANO
    Età: 58
    Utente Junior
    2010
    00 07/02/2018 16:50
    Buongiorno,
    ho un file che nel foglio di lavoro indice mi elenca tutti i fogli di lavoro presenti.
    Ma in realtà io vorrei escluderne alcuni.
    In pratica nel file allegato vorrei che nell'elenco indice NON fosse presente il foglio denominato FoglioProva.
      
    Private Sub cmdAggiorna_Click() 
    Dim I As Variant  
    lstIndice.Clear  
    For Each I In Worksheets     
    If I.Name <> "Indice" Then         
    lstIndice.AddItem I.Name     
    End If 
    Next I  
    End Sub  
    
    Private Sub cmdEsci_Click() 'Disattiva Messaggi Application.DisplayAlerts = False  
    'Salva File 
    ActiveWorkbook.Save  If Workbooks.Count > 1 Then     
    'Chiudi File     
    ActiveWorkbook.Close Else     
    'Chiudi Excels     
    Application.Quit 
    End If  
    'Attiva Messaggio 
    Application.DisplayAlerts = True 
    End Sub  
    Private Sub lstIndice_DblClick(ByVal Cancel As MSForms.ReturnBoolean) Worksheets(lstIndice.Value).Activate 
    End Sub  
    
    Private Sub Worksheet_Activate() 
    Dim I As Variant  
    lstIndice.Clear  
    For Each I In Worksheets     
    If I.Name <> "Indice" Then         
    lstIndice.AddItem I.Name     
    End If 
    Next I 
    End Sub


    Grazie per l'aiuto.
    [Modificato da BG66 07/02/2018 16:55]
    BG66
    Excel 2010
  • OFFLINE
    GiuseppeMN
    Post: 2.659
    Registrato il: 03/04/2013
    Utente Veteran
    Excel 2000 - 2013
    00 07/02/2018 18:13
    Buona sera, BG;
    che ne dici di provare con questa modifica?:

    If I.Name <> "Indice" And I.Name <> "FoglioProva" Then
        lstIndice.AddItem I.Name
    End If
    



    Bona serata.

    Giuseppe

    Windows XP - Excel 2000
    Windows 10 - Excel 2013
  • OFFLINE
    BG66
    Post: 218
    Registrato il: 13/12/2015
    Città: MILANO
    Età: 58
    Utente Junior
    2010
    00 07/02/2018 21:35
    Ciao Giuseppe,
    grazie tanto e [RISOLTO]

    Alla prossima
    BG66
    Excel 2010