Bonjour chers tous
Jai une macro associée à une Shape qui doit afficher ou masquer une feuille .
La chape doit changer de couleur et de texte si la feuille est affichée sinon reprendre l'état initial .
Jai nommé la Shape : pn
Option Explicit
Dim shp As Shape
Dim couleur As ColorFormat
Dim n As String
Sub aff()
Set shp = ActiveSheet.Shapes(pn)
couleur = shp.Fill.ForeColor.RGB
n = shp.TextFrame.Characters.Text
If n = "AFFICHER" Then
Application.ScreenUpdating = False
Sheets("Travail").Visible = True
shp.TextFrame.Characters.Text = "MASQUER"
shp.Fill.ForeColor.RGB = RGB(238, 93, 93)
Else
Application.ScreenUpdating = False
Sheets("Travail").Visible = False
shp.TextFrame.Characters.Text = "AFFICHER"
shp.Fill.ForeColor.RGB = couleur
End If
End Sub