| | Post: 249 | Registrato il: 13/12/2015
| Città: MILANO | Età: 58 | Utente Junior | 2010 | | OFFLINE | |
|
02/03/2019 20:51 | |
Ciao,
ammetto subito che il titolo è strano...ma non mi veniva di meglio!
In pratica per nascondere il foglio 2 uso questo script:
Private Sub Worksheet_Change(ByVal Target As Range)
If [G1] = "SI" Then
Sheets("Foglio2").Visible = False
Else
Sheets("Foglio2").Visible = True
End If
End Sub
Ma in questo modo sono costretto ogni volta a personalizzare il nome del foglio.
Immaginavo di dirgli in "questo foglio di lavoro":
-> se nella cella F2 di qualsiasi foglio del file inserisco la parola SI
-> nascondi il foglio.
Ma come?
Grazie per l'aiuto.
[Modificato da BG66 03/03/2019 15:05] BG66
Excel 2010 |
|
| | Post: 1.745 | Registrato il: 10/10/2013
| Città: VICENZA | Età: 69 | Utente Veteran | 365 | | OFFLINE |
|
02/03/2019 21:03 | |
ciao
Private Sub Worksheet_Change(ByVal Target As Range)
If [F2] = "SI" Then
ActiveSheet.Visible = True
Else
ActiveSheet.Visible = False
End If
End Sub
ma il tutto mi lascia perplesso
Else
ActiveSheet.Visible = False
non serve una volta nascosto col piffero che vari
la cella F2😄
ma come lo ripristini poi il foglio?
|
| | Post: 249 | Registrato il: 13/12/2015
| Città: MILANO | Età: 58 | Utente Junior | 2010 | | OFFLINE | |
|
02/03/2019 21:57 | |
Ciao @federico460,
per la variazione in F2 in realtà mi serve solo per tornare indietro nel caso qualcuno dei miei digita"erroneamente😆" SI ( per questo non ho previsto password).
Mentre ho già uno script nel foglio
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Set rng = Me.Range("D12:D4039")
If Not Intersect(Target, rng) Is Nothing And Target.Count = 1 Then
With Target
If .Offset(0, 7).Value = "" And Target.Value <> "" Then
.Offset(0, 7).Value = Now
.Offset(0, 7).NumberFormat = "dd/mm/yyyy hh:mm:ss"
.Locked = True
End If
End With
End If
Set rng = Nothing
End Sub
Possono convivere?
[Modificato da BG66 02/03/2019 22:02] BG66
Excel 2010 |
| | Post: 783 | Registrato il: 16/08/2015
| Città: CORDENONS | Età: 67 | Utente Senior | Excel 2016-32bit Win11 | | OFFLINE |
|
02/03/2019 22:10 | |
Un saluto a tutti.
In aggiunta a quanto suggerito federico460, e dopo aver chiarito il suo 'legittimo' dubbio (a meno d'aver un'ulteriore macro che scopre i fogli), per evitare di ripetere quella sua macro in ogni foglio potresti gestire l'evento Workbook_SheetChange in modo da metterne una sola nel modulo Questa_Cartella_di_Lavoro (ThisWorkbook) con:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
PS. vedo che ci sono stati degli sviluppi mentre scrivevo. [Modificato da rollis13 02/03/2019 22:13]
______________________________________________________________
C'è chi fa le COSE a CASO e chi fa CASO alle COSE (Ignoto) |
| | Post: 1.746 | Registrato il: 10/10/2013
| Città: VICENZA | Età: 69 | Utente Veteran | 365 | | OFFLINE |
|
02/03/2019 22:24 | |
penso di si
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Set rng = Me.Range("D12:D4039")
If Not Intersect(Target, rng) Is Nothing And Target.Count = 1 Then
With Target
If .Offset(0, 7).Value = "" And Target.Value <> "" Then
.Offset(0, 7).Value = Now
.Offset(0, 7).NumberFormat = "dd/mm/yyyy hh:mm:ss"
.Locked = True
End If
End With
End If
If [F2] = "SI" Then
ActiveSheet.Visible = False
End If
Set rng = Nothing
End Sub
|
| | Post: 250 | Registrato il: 13/12/2015
| Città: MILANO | Età: 58 | Utente Junior | 2010 | | OFFLINE | |
|
03/03/2019 11:30 | |
[RISOLTO]
Grazie a tutti.
Alla prossima. BG66
Excel 2010 |
|
|