Como añado un combobox a mi formulario

Ya me habían ayudado Dante en días pasado pero ahora tengo un problema resulta que tengo mi formulario con varios text box, quiero añadirle en el campo Asesores un combobox que me traiga todos los asesores y escoja uno de la lista, antes lo manejaba con un textbox, pero quiero añadírselo para que se escoja de la lista, aquí pego mi base:

ublic ubica As String
Public control As Integer
Public filalibre As Integer
Dim dato As String
Private Sub cmdCancelar_Click()
ActiveSheet.Select
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox13 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
TextBox9 = ""
TextBox10 = ""
TextBox11 = ""
TextBox12 = ""
TextBox1.SetFocus
End Sub
Private Sub cmdModificar_Click()
ActiveSheet.Select
Range(ubica).Value = TextBox1
Range(ubica).Offset(0, 2).Value = TextBox2
Range(ubica).Offset(0, 2).Value = TextBox3
Range(ubica).Offset(0, 3).Value = TextBox13
Range(ubica).Offset(0, 4).Value = TextBox5
Range(ubica).Offset(0, 5).Value = TextBox6
Range(ubica).Offset(0, 6).Value = TextBox7
Range(ubica).Offset(0, 7).Value = TextBox8
Range(ubica).Offset(0, 8).Value = TextBox9
Range(ubica).Offset(0, 9).Value = TextBox10
Range(ubica).Offset(0, 10).Value = TextBox11
Range(ubica).Offset(0, 11).Value = TextBox12
Range(ubica).Offset(0, 12).Value = TextBox13
cmdCancelar_Click
End Sub
Private Sub CommandButton1_Click()
rango = ubica & ":A" & filalibre
Set midato = ActiveSheet.Range(rango).Find(dato, LookIn:=xlValues, LookAt:=xlWhole)
If Not (midato) Is Nothing Then
ubica = midato.Address(False, False)
TextBox2.Value = Range(ubica).Offset(0, 2).Value
TextBox3.Value = Range(ubica).Offset(0, 3).Value
TextBox13.Value = Range(ubica).Offset(0, 4).Value
TextBox5.Value = Range(ubica).Offset(0, 5).Value
TextBox6.Value = Range(ubica).Offset(0, 6).Value
TextBox7.Value = Range(ubica).Offset(0, 7).Value
TextBox8.Value = Range(ubica).Offset(0, 8).Value
TextBox9.Value = Range(ubica).Offset(0, 9).Value
TextBox10.Value = Range(ubica).Offset(0, 10).Value
TextBox11.Value = Range(ubica).Offset(0, 11).Value
TextBox12.Value = Range(ubica).Offset(0, 12).Value
Else
cmdModificar.Enabled = False
cmdEliminar.Enabled = False
End If
Set midato = Nothing
End Sub
Private Sub contratos_Change()
Sheets(CONTRATOS.Text).Select
End Sub
PrivateSub UserForm_Activate()
For Each h In Sheets
CONTRATOS.AddItem h.Name
Next
End Sub
Private Sub CMDVOLVER_Click()
ActiveSheet.AutoFilterMode = False
End Sub
Private Sub ComboBox1_Enter()
Application.ScreenUpdating = False
Sheets("ASESORES").Activate
Range("B2").Select
End Sub
Private Sub CommandButton2_Click()
'Por Dam
Dim cell As Range
Dim Rng As Range
Asesor = TextBox16
ActiveSheet.AutoFilterMode = False
Range("A1:S250").Select
If Asesor = "" Then
MsgBox "No hay datos a filtrar, se seleccionan todos"
Else
'Filtra datos por Asesor
ActiveSheet.AutoFilterMode = False
Range("A1:G250").Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:=Asesor
End If
End Sub

Private Sub CommandButton3_Click()
'Por Dam
Dim cell As Range
Dim Rng As Range
Planilla = TextBox20
ActiveSheet.AutoFilterMode = False
Range("A1:S250").Select
If Planilla = "" Then
MsgBox "No hay datos a filtrar, se seleccionan todos"
Else
'Filtra datos por Asesor
ActiveSheet.AutoFilterMode = False
Range("A1:G250").Select
Selection.AutoFilter
Selection.AutoFilter Field:=7, Criteria1:=Planilla
End If
End Sub
Private Sub TextBox1_AfterUpdate()
cmdModificar.Enabled = True
cmdEliminar.Enabled = True
filalibre = Range("A2").End(xlDown).Offset(1, 0).Row 'la variable filalibre guarda el nro. De la primer celda vacía.
dato = TextBox1
rango = "A2:A" & filalibre
Set midato = ActiveSheet.Range(rango).Find(dato, LookIn:=xlValues, LookAt:=xlWhole)
If Not (midato) Is Nothing Then
ubica = midato.Address(False, False)
TextBox2.Value = Range(ubica).Offset(0, 1).Value
TextBox3.Value = Range(ubica).Offset(0, 2).Value
TextBox13.Value = Range(ubica).Offset(0, 3).Value
TextBox5.Value = Range(ubica).Offset(0, 4).Value
TextBox6.Value = Range(ubica).Offset(0, 5).Value
TextBox7.Value = Range(ubica).Offset(0, 6).Value
TextBox8.Value = Range(ubica).Offset(0, 7).Value
TextBox9.Value = Range(ubica).Offset(0, 8).Value
TextBox10.Value = Range(ubica).Offset(0, 9).Value
TextBox11.Value = Range(ubica).Offset(0, 10).Value
TextBox12.Value = Range(ubica).Offset(0, 11).Value
Else
cmdModificar.Enabled = False
cmdEliminar.Enabled = False
End If
Set midato = Nothing
End Sub
Private Sub cmdAgregar_Click()
Cells(filalibre, 1).Value = TextBox1
Cells(filalibre, 2).Value = TextBox2
Cells(filalibre, 3).Value = TextBox3
Cells(filalibre, 4).Value = TextBox13
Cells(filalibre, 5).Value = TextBox5
Cells(filalibre, 6).Value = TextBox6
Cells(filalibre, 7).Value = TextBox7
Cells(filalibre, 8).Value = TextBox8
Cells(filalibre, 9).Value = TextBox9
Cells(filalibre, 10).Value = TextBox10
Cells(filalibre, 11).Value = TextBox11
Cells(filalibre, 12).Value = TextBox12
cmdCancelar_Click
End Sub
Private Sub cmdEliminar_Click()
Range(ubica).EntireRow.Delete
cmdCancelar_Click
End Sub
Private Sub Workbook_Open()
FORMCONTRATOS.Show
End Sub
Private Sub CERRAR_Click()
Unload Me
End Sub

Private Sub CommandButton4_Click()
CONSULTA.Show
End Sub
Private Sub CommandButton5_Click()
PLANILLAS.Show
End Sub
Private Sub CommandButton6_Click()
ESTADO.Show
End Sub
Private Sub CommandButton7_Click()
UserForm1.Show
End Sub

Respuesta
1

Este código es de un ejemplo que dejé en mi sitio de descargas. Enviame por favor el formulario así le agrego lo que necesitas allí mismo. Mi correo aparece allí mismo sino toma nota: cibersoft_arg ARROBA yahoo.com. ar

Sdos!

Muchas Gracia Elsa, el Ejemplo lo tome de tu página de ejemplos.

Tengo una duda ahora quiero hacer una consulta de esta forma:

Cuando elija un Asesor, pueda también buscar el estado de los contratos, eso lo tengo en el formulario CONSULTA.

Muchas Gracias por tu ayuda

Veo que ya finalizaste al experto anterior, así que ya considero que la consulta está resuelta.

Quizás debieras finalizar ésta también atenta a que trabajé bastante en arreglar el libro que te envié x correo... si ahora tenés nuevas dudas por favor empecemos un nuevo tema, ¿no te parece?

Sdos!

1 respuesta más de otro experto

Respuesta
1

Me puedes enviar tu archivo con el formulario para adaptar el código.

Te envié el archivo

Saludos. Dante Amor

Si es lo que necesitas no olvides valorar la respuesta.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas