Página 1 de 1

Ocultar / exibir botões

Enviado: 16 Out 2017 às 09:24
por paparello
Bom dia a todos,

Tenho uma planilha com 2 botões de comando, onde quero, conforme o valor contido em A1, ocultar ou exibir um deles.
Exemplo: A1 = 0 , ocultar o botão 1. Se A1= 1, ocultar o botão 2.
Alguém pode me ajudar?
Agradeço antecipadamente

Re: Ocultar / exibir botões

Enviado: 16 Out 2017 às 09:42
por gfranco
Bom dia.
Veja se consegue adaptar à sua necessidade:
Código: Selecionar todos
Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("a1")) Is Nothing Then

If Target.Value = 0 Then
 Planilha1.Shapes("Botão 1").Visible = False
 Planilha1.Shapes("Botão 2").Visible = True
 

ElseIf Target.Value = 1 Then
 Planilha1.Shapes("Botão 1").Visible = True
 Planilha1.Shapes("Botão 2").Visible = False


End If



End If

End Sub

Re: Ocultar / exibir botões

Enviado: 16 Out 2017 às 15:08
por paparello
gfranco escreveu:Bom dia.
Veja se consegue adaptar à sua necessidade:
Código: Selecionar todos
Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("a1")) Is Nothing Then

If Target.Value = 0 Then
 Planilha1.Shapes("Botão 1").Visible = False
 Planilha1.Shapes("Botão 2").Visible = True
 

ElseIf Target.Value = 1 Then
 Planilha1.Shapes("Botão 1").Visible = True
 Planilha1.Shapes("Botão 2").Visible = False


End If



End If

End Sub
Muito obrigado Franco
Problema resolvido