Boa tarde! Estou precisando formatar uma célula em que a validação de dados seja feita por lista, porém que permita a seleção de mais de uma alternativa no menu suspenso. É possível?
Oi @orlandocjunior, só encontrei em Excel/VBA, (xlsm) não consegui conversão automática.
A macro é esta, se alguém se habilitar a converter…
Rem Attribute VBA_ModuleType=VBADocumentModule
Option VBASupport 1
Option Explicit
' Developed by Contextures Inc.
' www.contextures.com
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngDV As Range
Dim oldVal As String
Dim newVal As String
If Target.Count > 1 Then GoTo exitHandler
On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler
If rngDV Is Nothing Then GoTo exitHandler
If Intersect(Target, rngDV) Is Nothing Then
'do nothing
Else
Application.EnableEvents = False
newVal = Target.Value
Application.Undo
oldVal = Target.Value
Target.Value = newVal
If Target.Column = 3 Then
If oldVal = "" Then
'do nothing
Else
If newVal = "" Then
'do nothing
Else
Target.Value = oldVal _
& [a1] & " " & newVal
End If
End If
End If
End If
exitHandler:
Application.EnableEvents = True
End Sub
Pelo site http://www.business-spreadsheets.com/vba2oo.asp
consegui esta conversão, mas não funciona…
Rem Attribute VBA_ModuleType=VBADocumentModule
Option VBASupport 1
Option Explicit
' Developed by Contextures Inc.
' www.contextures.com
Private Sub Worksheet_Change(ByVal Target As Dim oSheet as Object[n]oSheet = ThisComponent.CurrentController.ActiveSheet[n]oSheet.getCellRangeByName($1))
Dim rngDV As Dim oSheet as Object[n]oSheet = ThisComponent.CurrentController.ActiveSheet[n]oSheet.getCellRangeByName($1)
Dim oldVal As String
Dim newVal As String
If Target.Count > 1 Then GoTo exitHandler
On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler
If rngDV Is Nothing Then GoTo exitHandler
If Intersect(Target, rngDV) Is Nothing Then
'do nothing
Else
Application.EnableEvents = False
newVal = Target.Value
Application.Undo
oldVal = Target.Value
Target.Value = newVal
If Target.Column = 3 Then
If oldVal = "" Then
'do nothing
Else
If newVal = "" Then
'do nothing
Else
Target.Value = oldVal _
& [a1] & " " & newVal
End If
End If
End If
End If
exitHandler:
Application.EnableEvents = True
End Sub