Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
  • Avatar do usuário
Por paparello
Posts
#27386
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
Avatar do usuário
Por gfranco
Avatar
#27387
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
Por paparello
Posts
#27396
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
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord