Notifications
Clear all

Usar ChekBox em VBA

3 Posts
3 Usuários
0 Reactions
986 Visualizações
(@rojas)
Posts: 0
New Member
Topic starter
 

ola sou novo aqui, bom tenho um formulário que e tem quatro opção de chekBox e quero salvar apenas os que selecionar no formulario e que passe para planilha usei isso no Botao - Salvar

Private Sub salvar_Click()

'Ativar a primeira planilha
ThisWorkbook.Worksheets("RRA").Activate
'Selecionar a célula A3
Range("A3").Select

'Procurar a primeira célula vazia
Do
If Not (IsEmpty(ActiveCell)) Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True

'Carregar os dados digitados nas caixas de texto para a planilha
ActiveCell.Value = TxtIdent.Value
ActiveCell.Offset(0, 1).Value = TxtReg.Value
ActiveCell.Offset(0, 2).Value = TxtDesc.Value
ActiveCell.Offset(0, 3).Value = TxtDat_amost.Value
ActiveCell.Offset(0, 4).Value = TxtDat_rec.Value
ActiveCell.Offset(0, 5).Value = TxtHora.Value
ActiveCell.Offset(0, 6).Value = TxtResp.Value

'Físico Químico
If Boxfq.Value = True Then
ActiveCell.Offset(0, 7).Value = X
Else
ActiveCell.Offset(0, 7).Value = 0
End If

'Limpar as caixas de texto
TxtIdent.Value = Empty
TxtReg.Value = Empty
TxtDesc.Value = Empty
TxtDat_amost.Value = Empty
TxtDat_rec.Value = Empty
TxtHora.Value = Empty
TxtResp.Value = Empty

'Colocar o foco na primeira caixa de texto
TxtIdent.SetFocus

End Sub

 
Postado : 08/10/2015 6:57 am
(@wfranca)
Posts: 297
Honorable Member
 

Rojas,

vc pode inserir o código abaixo no seu botão salvar

Range("A1").Value = CDate(checkbox.Text)

e no evento do seu click do seu checkbox vc pode informar o valor que deseja

checkbox.value = "meu texto aqui"

 
Postado : 08/10/2015 6:30 pm
(@tarcelles)
Posts: 0
New Member
 

'Físico Químico
If Boxfq.Value = True Then
ActiveCell.Offset(0, 7).Value = "Físico Químico"
Else
ActiveCell.Offset(0, 7).Value = "Outra Função"
End If

 
Postado : 26/10/2015 1:17 pm