Una famiglia di software per fogli di calcolo Microsoft con strumenti per l'analisi, la creazione di grafici e la comunicazione dei dati.
ho provato ma modificare il codice e a mettere la protezione delle celle bloccate nel foglio però quando premo il commandbox "nascondi colonne" ho un errore.
Nell'immagine sotto si vede
Password ha 2 s.
Public Sub mNascondiColonne()
Dim rng As Range
Dim c As Range
Dim sh As Worksheet
Dim s As String
Dim lng As Long
Dim bln As Boolean
Set sh = ThisWorkbook.Worksheets("Foglio1")
Application.ScreenUpdating = False
With sh
.Unprotect Password:="123"
For lng = 19 To 35
s = ""
s = f(lng)
bln = False
Set rng = .Range(s & "7:" & s & "38")
For Each c In rng
If c.Value <> "" Then bln = True
Next
If bln = False Then
.Range(s & ":" & s).Columns.EntireColumn.Hidden = True
End If
Next
.Protect Password:="123"
End With
Application.ScreenUpdating = True
Set c = Nothing
Set rng = Nothing
Set sh = Nothing
End Sub
Public Sub mMostraColonne()
Dim sh As Worksheet
Set sh = ThisWorkbook.Worksheets("Foglio1")
With sh
.Unprotect Password:="123"
.Range("S:AI").Columns.EntireColumn.Hidden = False
.Protect Password:="123"
End With
Set sh = Nothing
End Sub
Private Function f(ByVal lng As Long) As String
f = Split(Cells(1, lng).Address( _
True, False, xlA1, False), "$")(0)
End Function