Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá pessoal, como transformar um código VBA em Java Script no Google Drive:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("Listagem Completa").Unprotect "1234"
Dim rngDV As Range
Dim oldVal As String
Dim newVal As String
Dim lUsed As Long
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 = 25 _
Or Target.Column = 28 _
Or Target.Column = 30 _
Or Target.Column = 31 _
Or Target.Column = 32 _
Or Target.Column = 33 _
Or Target.Column = 34 Then
If oldVal = "" Then
'do nothing
Else
If newVal = "" Then
'do nothing
Else
lUsed = InStr(1, oldVal, newVal)
If lUsed > 0 Then
If Right(oldVal, Len(newVal)) = newVal Then
Target.Value = Left(oldVal, Len(oldVal) - Len(newVal) - 2)
Else
Target.Value = Replace(oldVal, newVal & ", ", "")
End If
Else
Target.Value = oldVal _
& ", " & newVal
End If
End If
End If
End If
End If
exitHandler:
Application.EnableEvents = True
Worksheets("Listagem Completa").Protect "1234"
End Sub
Eu tenho uma planilha excel com "x" colunas de dados, e em outra planilha eu chamo essa lista através da validação de dados. É possível escolher na célula mais de uma opção da lista da mesma coluna!
Alguém sabe como resolver isso, pois não tenho em capacidade de programação em java!
obrigado a todos!!
Carregando comentários...