H o l a:
En las celdas AA1:¿AA47 tienes los datos que cargaste en la lista de validación?
¿Y en cuáles celdas vas a ocupar esa lista de validación?
Vamos a suponer que en el rango B2:B100 vas a poner la funcionalidad de la lista de validación.
Entonces cada que selecciones una celda del rango B2:B100 en automático te mostrará los datos que están disponibles.
Pon la siguiente macro en los eventos de tu hoja:
Private Sub Worksheet_SelectionChange(ByVal target As Range)
'Por.Dante Amor
If target.Count > 1 Then Exit Sub
'
Set celdas = Range("B2:B100")
If Not Intersect(target, celdas) Is Nothing Then
Columns("AB").Clear
j = 1
For Each r In Range("AA1:AA47")
existe = False
For Each c In celdas.SpecialCells(xlCellTypeConstants, 23)
If c.Address <> target.Address Then
If r.Value = c.Value Then
existe = True
Exit For
End If
End If
Next
If existe = False Then
Cells(j, "AB") = r.Value
j = j + 1
End If
Next
'
u2 = Range("AB" & Rows.Count).End(xlUp).Row
With target.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=AB1:AB" & u2
.IgnoreBlank = True: .InCellDropdown = True
.InputTitle = "": .ErrorTitle = ""
.InputMessage = "": .ErrorMessage = ""
.ShowInput = True: .ShowError = True
End With
End If
End Sub
Sigue las Instrucciones para poner la macro en los eventos de worksheet
- Abre tu libro de excel
- Para abrir Vba-macros y poder pegar la macro, Presiona Alt + F11
- Del lado izquierdo dice: VBAProject, abajo dale doble click a worksheet(tu hoja)
- Del lado derecho copia la macro
‘
S a l u d o s . D a n t e A m o r. Recuerda valorar la respuesta. G r a c i a s
‘_