Como mostrar datos en combobox

Tengo la siguiente macro que realiza búsqueda de datos en la hoja "LIDER" pero no muestra la información en los combobox 2, 3 y 4, agradezco por favor su ayuda en la resolución de este problema.

Private Sub CommandButton11_Click()
Application.ScreenUpdating = False
Sheets("LIDER").Select
codi = TextBox1.Value
Set busco = Range("A3:A" & Range("A" & Rows.Count).End(xlUp).Row).Find(codi, LookIn:=xlValues, lookat:=xlWhole)
If Not busco Is Nothing Then
CommandButton4.Visible = True
Range("A" & busco.Row).Select
Me.TextBox2 = ActiveCell.Offset(0, 1)
Me.TextBox3 = ActiveCell.Offset(0, 3)
Me.TextBox4 = ActiveCell.Offset(0, 4)
Me.TextBox5 = ActiveCell.Offset(0, 7)
Me.ComboBox1 = ActiveCell.Offset(0, 2)
Me.ComboBox2 = ActiveCell.Offset(0, 5)
Me.ComboBox3 = ActiveCell.Offset(0, 6)
Me.ComboBox4 = ActiveCell.Offset(0, 8)
TextBox1.SetFocus
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1)
CommandButton1.Visible = False
CommandButton3.Visible = False
Else
MsgBox "LIDER NO REGISTRADO.", vbQuestion, "Información Importante"
TextBox1.SetFocus
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1)
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""
CommandButton1.Visible = True
CommandButton11.Visible = True
CommandButton4.Visible = False
End If
End Sub

1 respuesta

Respuesta
1

Intenta con la instrucción: ComboBox1. Items. Add(ActiveCell.Offset(0, 2))

¡Gracias! Hermano ya lo solucione de esta manera

Private Sub CommandButton11_Click()
Application.ScreenUpdating = False
Sheets("LIDER").Select
codi = TextBox1.Value
Set busco = Range("A3:A" & Range("A" & Rows.Count).End(xlUp).Row).Find(codi, LookIn:=xlValues, lookat:=xlWhole)
If Not busco Is Nothing Then
CommandButton4.Visible = True
Range("A" & busco.Row).Select
Me.TextBox2 = ActiveCell.Offset(0, 1)
Me.TextBox3 = ActiveCell.Offset(0, 3)
Me.TextBox4 = ActiveCell.Offset(0, 4)
Me.TextBox5 = ActiveCell.Offset(0, 7)
Me.ComboBox2.Text = ActiveCell.Offset(0, 5)
Me.ComboBox3.Text = ActiveCell.Offset(0, 6)
Me.ComboBox4.Text = ActiveCell.Offset(0, 8)
Me.ComboBox1.Text = ActiveCell.Offset(0, 2)
TextBox1.SetFocus
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1)
CommandButton1.Visible = False
CommandButton3.Visible = False
Else
MsgBox "LIDER NO REGISTRADO.", vbQuestion, "Información Importante"
TextBox1.SetFocus
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1)
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""
CommandButton1.Visible = True
CommandButton11.Visible = True
CommandButton4.Visible = False
End If
End Sub

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas