Bonjour,
Je souhaiterais démasquer une serie de colonne et ne masquer que celles qui seront vide et cela sur les douze feuilles (janvier/décembre) avec un bouton de commande qui change de couleur.
Voici mon bout de prog qui bien sure ne fonctionne pas.
Dim i As Integer
Dim col As Variant
Private Sub CommandButton3_Click()
If CommandButton3.Caption = "Masqué" Then
CommandButton3.BackColor = &HFF&
For i = 1 To Sheets.Count
Sheets(i). For col = 170 To 206
With Feuil1.Cells(64, col)
If .Value = "" Then Columns(col).Hidden = True
End With
Next col
Next i
CommandButton3.Caption = "DéMasqué"
CommandButton3.BackColor = &HC000&
Else
For i = 1 To Sheets.Count
Sheets(i). For col = 170 To 206
With Feuil1.Cells(64, col)
If .Value = "" Then Columns(col).Hidden = False
End With
Next col
Next i
CommandButton3.Caption = " Masqué "
CommandButton3.BackColor = &HFF&
End If
End Sub
Je souhaiterais démasquer une serie de colonne et ne masquer que celles qui seront vide et cela sur les douze feuilles (janvier/décembre) avec un bouton de commande qui change de couleur.
Voici mon bout de prog qui bien sure ne fonctionne pas.
Dim i As Integer
Dim col As Variant
Private Sub CommandButton3_Click()
If CommandButton3.Caption = "Masqué" Then
CommandButton3.BackColor = &HFF&
For i = 1 To Sheets.Count
Sheets(i). For col = 170 To 206
With Feuil1.Cells(64, col)
If .Value = "" Then Columns(col).Hidden = True
End With
Next col
Next i
CommandButton3.Caption = "DéMasqué"
CommandButton3.BackColor = &HC000&
Else
For i = 1 To Sheets.Count
Sheets(i). For col = 170 To 206
With Feuil1.Cells(64, col)
If .Value = "" Then Columns(col).Hidden = False
End With
Next col
Next i
CommandButton3.Caption = " Masqué "
CommandButton3.BackColor = &HFF&
End If
End Sub