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.
#60420
Olá,

Gostaria de saber como bloquear um combobox active x de acordo com uma resposta anterior. Para ilustrar anexei um exemplo: se eu responder não à pergunta 1 gostaria que as caixas referentes 1.1 e 1.2 fossem desabilitadas.

Pelo que já pesquisei existe as possibilidades de enable e visible pro combobox mas não estou sabendo integrar à macro que já existe (referente aos botões on/off)

A macro que estou usando para os botões de on/off é

Sub PrimeiroBotao()
'Macro definidora das atividades por detrás do primeiro botão de resposta

Application.ScreenUpdating = True

Dim botao1 As String
Dim botao2 As String
Dim botao3 As String
Dim NomeSheet As String

'Dim shp1 As Shape
'Dim shp2 As Shape
'Dim shp3 As Shape

NomeSheet = ActiveSheet.Range("V1")
botao1 = "botao1_Q" & NomeSheet
botao2 = "botao2_Q" & NomeSheet
botao3 = "botao3_Q" & NomeSheet

Set shp1 = ActiveSheet.Shapes(botao1)
Set shp2 = ActiveSheet.Shapes(botao2)
Set shp3 = ActiveSheet.Shapes(botao3)

' Mudar posição e cor

If ActiveSheet.Range("A1") = "On" Then
shp1.Select
With Selection
.ShapeRange.IncrementLeft -38
.ShapeRange.Fill.ForeColor.RGB = RGB(175, 171, 171)
End With
ActiveSheet.Range("A1") = "Off"
ActiveSheet.Range("A1").Activate
Else
shp1.Select
With Selection
.ShapeRange.IncrementLeft 38
.ShapeRange.Fill.ForeColor.RGB = RGB(89, 192, 213)
End With

If ActiveSheet.Range("B1") = "On" Then
shp2.Select
With Selection
.ShapeRange.IncrementLeft -38
.ShapeRange.Fill.ForeColor.RGB = RGB(175, 171, 171)
End With
ActiveSheet.Range("B1") = "Off"
End If
If ActiveSheet.Range("C1") = "On" Then
shp3.Select
With Selection
.ShapeRange.IncrementLeft -38
.ShapeRange.Fill.ForeColor.RGB = RGB(175, 171, 171)
End With
ActiveSheet.Range("C1") = "Off"
End If

ActiveSheet.Range("A1") = "On"
ActiveSheet.Range("E1") = 1
ActiveSheet.Range("A1").Activate
End If

Application.ScreenUpdating = False

End Sub

Agradeceria muito a ajuda!
Você não está autorizado a ver ou baixar esse anexo.
#60421
O primeiro comando abaixo desabilita e o segundo oculta. Veja se aproveita algum deles.

ActiveSheet.OLEObjects("Combobox1").Enabled = True 'False
ActiveSheet.OLEObjects("Combobox1").Visible = True 'False


Na Sub PrimeiroBotao():
1. para desabilitar ou ocultar coloque o comando abaixo desta linha ~~~> If ActiveSheet.Range("A1") = "On" Then ~~~> com a opção True.

2. para reabilitar ou reexibir coloque o comando abaixo desta linha ~~~> Else ~~~> com a opção False
Bikke agradeceu por isso
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