Notifications
Clear all

Lista suspensa VBA

3 Posts
1 Usuários
0 Reactions
1,176 Visualizações
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

Boa Tarde,

Preciso de uma rotina, que ao usuário digitar um código, insere uma lista suspensa na coluna ao lado.
Da forma que criei (sou leiga em vba) insere a lista se rodar a macro, mas eu preciso que insira assim que for digitado.
Sei que existe o Private Sub Worksheet_Change(ByVal Target As Range) que faz isso acontecer
mas quando altero de Sub PARA Private Sub não acontece nada

conto com ajuda de vocês

Desde já muito obrigada!

Obs.: Algúem conhece uma forma dos dados da lista suspensa ficar no código VBA, sem precisar estar inserido na planilha?

Sub teste()
Dim vrNum As String

If Not Intersect(Selection, Columns(13)) Is Nothing Then

'e = ActiveCell.Value
'If e = "2232" Then

For Each rngCell In Selection.Cells
If rngCell = "2232" Then
 With rngCell.Offset(0, 1).Validation
 
        .Delete
        .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
        xlBetween, Formula1:="='TABELA REDE_RECARGA'!A2:A18"
        .IgnoreBlank = True
        .InCellDropdown = True
        .InputTitle = ""
        .ErrorTitle = ""
        .InputMessage = ""
        .ErrorMessage = ""
        .ShowInput = True
        .ShowError = True
    End With

 ElseIf rngCell = "3781" Then
 With rngCell.Offset(0, 1).Validation
        .Delete
        .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
        xlBetween, Formula1:="='TABELA REDE_RECARGA'!b3:b29"
        .IgnoreBlank = True
        .InCellDropdown = True
        .InputTitle = ""
        .ErrorTitle = ""
        .InputMessage = ""
        .ErrorMessage = ""
        .ShowInput = True
        .ShowError = True
    End With

End If
Next rngCell
End If
    Sheets("Plan1").Select

End Sub
 
Postado : 07/10/2011 1:54 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

Sem VBA dá pra fazer mole... Postando a planilha ajuda muito.

Abs,

 
Postado : 07/10/2011 1:59 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 


Sugestão...

 
Postado : 07/10/2011 2:28 pm