Featured Replies
Archivado
Este tema está ahora archivado y está cerrado a más respuestas.
A better way to browse. Learn more.
A full-screen app on your home screen with push notifications, badges and more.
Este tema está ahora archivado y está cerrado a más respuestas.
Al tratar de llamar los datos de una ciudad que se encuentra en un combo box, me registra el siguiente error:
- Error 1004 la propiedad VLookup de la clase WorksheetFunction.
Nota: Cabe aclarar que una vez seleccione la ciudad al dar click en el boton buscar es cuando me aparece el error.
Public Info As Worksheet Public Hoja2 As Worksheet Private Sub btnBuscar_Click() If cbProvincia.ListIndex = -1 Then MsgBox ("Seleccione una Provincia"), vbExclamation ElseIf cbMunicipio.ListIndex = -1 Then MsgBox ("Seleccione un Municipio"), vbExclamation Else Valor = Application.WorksheetFunction.VLookup(Me.cbMunicipio.Value, Sheets("Info").Range("A:AP"), 4, 0) Me.txtVeredas.Value = Valor End If End Sub Private Sub cbProvincia_Change() Set municipios = Sheets("Info") nfilas = municipios.Cells(Rows.Count, "A").End(xlUp).Row Me.cbMunicipio.Clear For i = 2 To nfilas If Me.cbProvincia = municipios.Cells(i, 2) Then Me.cbMunicipio.AddItem Me.cbMunicipio.List(Me.cbMunicipio.ListCount - 1, 0) = municipios.Cells(i, 3) End If Next End Sub Private Sub UserForm_Activate() 'Me.listaDb.RowSource = "BASEDATOS" 'Me.listaDb.ColumnCount = 42 End Sub Private Sub UserForm_Initialize() Set provincias = Sheets("Hoja2") nfilas = provincias.Cells(Rows.Count, "A").End(xlUp).Row Me.cbProvincia.Clear For i = 16 To nfilas Me.cbProvincia.AddItem Me.cbProvincia.List(Me.cbProvincia.ListCount - 1, 0) = provincias.Cells(i, 1) Next End Sub