Macro smi-funcional
Publicado por JoaoM (222 intervenciones) el 16/05/2014 01:59:44
Tengo y uso esta macro en un evento, que el amigo JuanC me facilito y funciona perfecto;
pero en el siguiente evento
no me funciona como deveria ser
Si uso la anterior que estaba, ESTA
si funciona perfecto
La idea es usar el Array para los TextBox
La 1ª macro solo funciona la 1ª ves al hacer click en el ListBox (lista). Si vuelvo a hacer click en otra linea del ListBox no hace nada y deveria cambiar el contenido de los TextBox segun la linea donde hago Click en el ListBox.
Amigo JuanC, te buscan vivo o vivo, jejejejej.
Gracias por adelantado
1
2
3
4
5
6
7
8
9
10
11
Private Sub cmb_cod_Client_Change() 'SELECCION DE CLIENTE por medio del ComboBox
Sheets("Clientes").Activate
Dim v As Variant, txt As MSForms.TextBox
Dim i%
v = Array(TextBox1, TextBox2, TextBox3, TextBox4, TextBox5, TextBox6)
Range("A2").Activate
For i = 0 To UBound(v)
Set txt = v(i)
txt.Text = ActiveCell.Offset(0, i + 1)
Next
End Sub
pero en el siguiente evento
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Private Sub lista_Click()
On Error Resume Next
With Sheets("CLIENTES")
rw = .Range("a2:b50000").Find(lista, lookat:=xlWhole).Row 'b5
End With
'xxxxxxxxxx
Dim v As Variant, txt As MSForms.TextBox
Dim i%
v = Array(txtRIF, txtNombre, txtDirecci, txtP_Ciud, txtTelf1, txtTelf2, txtFech)
Range("A2").Activate
For i = 0 To UBound(v)
Set txt = v(i)
txt.Text = ActiveCell.Offset(0, i)
Next
'xxxxxxxxxx
'txtRIF = .Cells(rw, 1)
'txtNombre = .Cells(rw, 2)
'txtDirecci = .Cells(rw, 3)
'txtP_Ciud = .Cells(rw, 4)
'txtTelf1 = .Cells(rw, 5)
'txtTelf2 = .Cells(rw, 6)
'txtFech = .Cells(rw, 7)
End Sub
no me funciona como deveria ser
Si uso la anterior que estaba, ESTA
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Private Sub lista_Click()
On Error Resume Next
With Sheets("CLIENTES")
rw = .Range("a2:b50000").Find(lista, lookat:=xlWhole).Row 'b5
txtRIF = .Cells(rw, 1)
txtNombre = .Cells(rw, 2)
txtDirecci = .Cells(rw, 3)
txtP_Ciud = .Cells(rw, 4)
txtTelf1 = .Cells(rw, 5)
txtTelf2 = .Cells(rw, 6)
txtFech = .Cells(rw, 7)
End With
End Sub
La idea es usar el Array para los TextBox
La 1ª macro solo funciona la 1ª ves al hacer click en el ListBox (lista). Si vuelvo a hacer click en otra linea del ListBox no hace nada y deveria cambiar el contenido de los TextBox segun la linea donde hago Click en el ListBox.
Amigo JuanC, te buscan vivo o vivo, jejejejej.
Gracias por adelantado
Valora esta pregunta


0