
Option Explicit
Sub Nascondi()
Dim sh As Worksheet
Dim testo As String, sSPlit() As String, IBox As String, Foglio As String
Dim K As Integer
IBox = InputBox("immettere Nomi o parziale di nomi divisi da virgola" _
& Chr(10) & " ess. Pippo,Pluto")
sSPlit = SPlit(IBox, ",")
For K = LBound(sSPlit) To UBound(sSPlit)
testo = sSPlit(K)
For Each sh In Worksheets
Foglio = sh.Name
If Foglio <> "NascondiScopri" Then
If InStr(1, Foglio, testo, 1) > 0 Then
Sheets(Foglio).Visible = False
End If
End If
Next
Next K
End Sub
Sub Scopri()
Dim sh As Worksheet
Dim testo As String, sSPlit() As String, IBox As String, Foglio As String
Dim K As Integer
IBox = InputBox("immettere Nomi o parziale di nomi divisi da virgola" _
& Chr(10) & " ess. Pippo,Pluto")
sSPlit = SPlit(IBox, ",")
For K = LBound(sSPlit) To UBound(sSPlit)
testo = sSPlit(K)
For Each sh In Worksheets
Foglio = sh.Name
If Foglio <> "NascondiScopri" Then
If InStr(1, Foglio, testo, 1) > 0 Then
Sheets(Foglio).Visible = True
End If
End If
Next
Next K
End Sub
|
Option Explicit
Sub ListaFogli()
Dim sh As Worksheet
Dim nriga As Long
Dim StatoF As Integer
nriga = 1
Range("A1:B100").ClearContents
For Each sh In Worksheets
If sh.Name <> "NascondiScopri" Then
Cells(nriga, 1) = sh.Name
StatoF = sh.Visible
If StatoF = 0 Then
Cells(nriga, 2) = "Nascosto"
Else
Cells(nriga, 2) = "Visibile"
End If
nriga = nriga + 1
End If
Next
End Sub
Private Sub worksheet_beforedoubleclick(ByVal target As Range, cancel As Boolean)
If Intersect(target, Range("A1:A100")) Is Nothing Then Exit Sub
Dim StatoF As Integer
''Application.ScreenUpdating = False
On Error GoTo salta
StatoF = Sheets(target.Value).Visible
If StatoF = 0 Then
Sheets(target.Value).Visible = True
Else
Sheets(target.Value).Visible = False
End If
salta:
Call ListaFogli
''Application.ScreenUpdating = True
End Sub
|
Private Sub CommandButton1_Click()
Dim i As Integer
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then _
Worksheets(ListBox1.List(i)).Visible = False
Next i
Unload Me
End Sub
Private Sub CommandButton2_Click()
Dim i As Integer
For i = 0 To ListBox2.ListCount - 1
If ListBox2.Selected(i) Then _
Worksheets(ListBox2.List(i)).Visible = True
Next i
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim i As Integer
For i = 1 To Sheets.Count
If Sheets(i).Visible = True Then
Me.ListBox1.AddItem Sheets(i).Name
Else
Me.ListBox2.AddItem Sheets(i).Name
End If
Next i
End Sub
|
