Estou usando o seguinte código VBA para permitir o preenchimento automático ao digitar na lista suspensa usando uma caixa de combinação.
Esse código desabilita as funções "Desfazer" e "Refazer" nas planilhas às quais o código VBA é aplicado. O código VBA pode ser modificado para permitir essas funções?
Sub Worksheet_SelectionChange particular (destino ByVal como intervalo)
'Atualizar por Extendoffice: 2018 / 9 / 21
Dim xCombox como OLEObject
Dim xStr como string
Dim xWs como planilha
Dim xArr
Definir xWs = Application.ActiveSheet
On Error Resume Next
Set xCombox = xWs.OLEObjects("TempCombo")
Com xCombox
.ListFillRange = ""
.LinkedCell = ""
.Visível = Falso
Terminar com
Se Target.Validation.Type = 3 Then
Target.Validation.InCellDropdown = Falso
Cancelar = Verdadeiro
xStr = Destino.Validação.Formula1
xStr = Direita(xStr, Len(xStr) - 1)
If xStr = "" Então Exit Sub
Com xCombox
.Visível = Verdadeiro
.Esquerda = Alvo.Esquerda
.Top = Alvo.Top
.Largura = Alvo.Largura + 5
.Altura = Altura.Altura + 5
.ListFillRange = xStr
Se .ListFillRange = "" Então
xArr = Split(xStr, ","")
Me.TempCombo.List = xArr
Se acabar
.LinkedCell = Destino.Endereço
Terminar com
xCombox.Ativar
Me.TempCombo.DropDown
Se acabar
End Sub
Privado Sub TempCombo_KeyDown (ByVal KeyCode como MSForms.ReturnInteger, ByVal Shift como inteiro)
Selecione o código-chave do caso
Caso 9
Application.ActiveCell.Offset(0, 1).Ativar
Caso 13
Application.ActiveCell.Offset(1, 0).Ativar
End Select
End Sub
Esse código desabilita as funções "Desfazer" e "Refazer" nas planilhas às quais o código VBA é aplicado. O código VBA pode ser modificado para permitir essas funções?
Sub Worksheet_SelectionChange particular (destino ByVal como intervalo)
'Atualizar por Extendoffice: 2018 / 9 / 21
Dim xCombox como OLEObject
Dim xStr como string
Dim xWs como planilha
Dim xArr
Definir xWs = Application.ActiveSheet
On Error Resume Next
Set xCombox = xWs.OLEObjects("TempCombo")
Com xCombox
.ListFillRange = ""
.LinkedCell = ""
.Visível = Falso
Terminar com
Se Target.Validation.Type = 3 Then
Target.Validation.InCellDropdown = Falso
Cancelar = Verdadeiro
xStr = Destino.Validação.Formula1
xStr = Direita(xStr, Len(xStr) - 1)
If xStr = "" Então Exit Sub
Com xCombox
.Visível = Verdadeiro
.Esquerda = Alvo.Esquerda
.Top = Alvo.Top
.Largura = Alvo.Largura + 5
.Altura = Altura.Altura + 5
.ListFillRange = xStr
Se .ListFillRange = "" Então
xArr = Split(xStr, ","")
Me.TempCombo.List = xArr
Se acabar
.LinkedCell = Destino.Endereço
Terminar com
xCombox.Ativar
Me.TempCombo.DropDown
Se acabar
End Sub
Privado Sub TempCombo_KeyDown (ByVal KeyCode como MSForms.ReturnInteger, ByVal Shift como inteiro)
Selecione o código-chave do caso
Caso 9
Application.ActiveCell.Offset(0, 1).Ativar
Caso 13
Application.ActiveCell.Offset(1, 0).Ativar
End Select
End Sub