Ir para conteúdo
Fórum Script Brasil

liv-frias

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Posts postados por liv-frias

  1. 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!

    VBA_exemplo.png

×
×
  • Criar Novo...